Answer: In Gemini CLI headless mode, exit code 0 means Success, 1 means General error or API failure, 42 means Input error (invalid prompt or arguments), and 53 means Turn limit exceeded. Status: Confirmed Entry: tool/gemini-cli/troubleshooting/headless-exit-codes Revision: 1 Digest: sha256:a95bb1f6f36581cb (changes whenever the content changes) Timeline: Created: 2026-11-13T03:17:34Z Last changed: 2026-11-13T03:17:34Z Last verified: 2026-11-20T12:51:04Z Next check: 2026-11-21T12:51:04Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of Exit code 0 | 0 | [1] | 2026-11-20 Exit code 1 | 1 | [1] | 2026-11-20 Exit code 42 | 42 | [1] | 2026-11-20 Exit code 53 | 53 | [1] | 2026-11-20 Sources: [1] Google. "Headless mode reference". https://geminicli.com/docs/cli/headless.md Role: primary. Accessed: 2026-11-20T12:51:04Z Quote: "`0`: Success." (Supports: Exit code 0) Quote: "`1`: General error or API failure." (Supports: Exit code 1) Quote: "`42`: Input error (invalid prompt or arguments)." (Supports: Exit code 42) Quote: "`53`: Turn limit exceeded." (Supports: Exit code 53) Published: 2026-10-16T02:36:07Z Snapshot SHA-256: 0c76556026820577ca1ead8c836c590a079e637100bff9790c0f1599d0f9f172 (captured 2026-11-13T03:17:33Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:17:34Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:51:04Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:51:04Z Last attempt: 2026-11-20T12:51:04Z Notes and limitations: Extracted automatically from a single official source (section "Exit codes"). Related: https://latestn.com/tool/gemini-cli/troubleshooting/instrument-code-traces How do I instrument code with traces in Gemini CLI? https://latestn.com/tool/gemini-cli/troubleshooting/mcp-server-connection-issues How do I troubleshoot an MCP server that won't connect in Gemini CLI? https://latestn.com/tool/gemini-cli/troubleshooting/regenerate-model-responses How do I regenerate model responses for Gemini CLI integration tests? https://latestn.com/tool/gemini-cli/troubleshooting/find-or-create-github-issues How do I find existing GitHub issues for Gemini CLI or create a new one? https://latestn.com/tool/gemini-cli/troubleshooting/fix-429-resource-exhausted Why am I getting an API error 429 Resource exhausted in Gemini CLI? https://latestn.com/tool/gemini-cli/troubleshooting/fix-named-user-subscription-error How do I fix the Gemini CLI authentication error about needing a named user on an organization's Gemini Code Assist Standard edition subscription? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:17:34Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/gemini-cli/troubleshooting/headless-exit-codes/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/gemini-cli/troubleshooting/headless-exit-codes POST: https://latestn.com/dispute/tool/gemini-cli/troubleshooting/headless-exit-codes with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/gemini-cli/troubleshooting/headless-exit-codes?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). What do the exit codes mean in Gemini CLI headless mode? Revision 1, last verified 2026-11-20T12:51:04Z. https://latestn.com/tool/gemini-cli/troubleshooting/headless-exit-codes (accessed 2026-11-21T09:54:50Z). @misc{LatestN_tool_gemini_cli_troubleshooting_headless_exit_codes_r1, title = {What do the exit codes mean in Gemini CLI headless mode?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/gemini-cli/troubleshooting/headless-exit-codes}}, note = {Revision 1; digest sha256:a95bb1f6f36581cb; last verified 2026-11-20T12:51:04Z; accessed 2026-11-21T09:54:50Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/gemini-cli/troubleshooting/headless-exit-codes