Reference
Error Codes Stable codes used across CLI failure envelopes and MCP.
All recoverable failures emit the same code whether you're using CLI ({ ok: false, code, message, details? }) or MCP (forwarded to the client as text).
Code Meaning Resolve no_api_keyNo key found in --api-key / DLAZY_API_KEY / config / login Run dlazy login or dlazy auth set <key> unauthorizedKey is invalid or revoked Re-auth with a fresh key forbiddenAuthenticated but not allowed (tier / org) Check plan or org membership insufficient_balanceOrg out of credits Top up; CLI prints estimate before charging when possible cli_version_too_lowServer rejected the request because the local CLI is below details.minVersion (HTTP 426) Run details.upgradeCommand (default npm install -g @dlazy/cli@1.2.0) and retry
Code Meaning Exit missing_fieldA required field has no value, no --input key, no stdin ref, no default 2 invalid_requestSchema validation rejected the payload 1 tool_not_foundUnknown cli_name (CLI / MCP) 2 bad_refInvalid pipeline reference token 2 no_stdinA reference token used (- / @N) but stdin is empty 2 input_file_not_found--input @path doesn't resolve to a file2 input_file_bad_json--input JSON is malformed or not an object2
Code Meaning file_not_foundLocal media flag points to a missing file file_too_largeFile exceeds 500 MB upload cap upload_failedObject-storage upload failed; cause in details
Code Meaning network_errorTransport failure before reaching the API task_failedProvider rejected or aborted the task; details in details timeoutAsync polling exceeded --timeout internal_errorUnexpected CLI error (file a bug)
dlazy gpt-image-2 --prompt "..." | jq -e ".ok" > /dev/null \
|| jq -r '.code, .message' < /dev/stderr