Skip to content

Robust Error Handling #6745

@jerop

Description

@jerop

Problem

Currently, Gemini CLI exits with code 0 for most scenarios, including some failure conditions like hitting maxSessionTurns. This makes it difficult for downstream consumers (like GitHub Actions and other automations) to programmatically distinguish between different types of failures and handle them appropriately. Learn more in google-github-actions/run-gemini-cli#217.

Solution

Implement standardized error messages or exit codes that allow consumers to programmatically handle different failure scenarios, for example:


1. Success (operation completed successfully)
2. General failure (catch-all for unspecified errors)
3. Authentication failure (invalid API keys, token issues)
4. Rate limit exceeded (API quota or rate limiting)
5. Session limit reached (maxSessionTurns exceeded)
6. Network/connectivity issues (timeouts, etc.)
7. Invalid configuration (malformed settings.json, invalid parameters)
8. Permission denied (insufficient access rights)
9. Resource not found (invalid model, missing files)
10. Input validation error (invalid prompt, malformed input)

@leehagoodjames @sethvargo as discussed in google-github-actions/run-gemini-cli#206 (comment)

cc @jacob314 @bdmorgan

Metadata

Metadata

Assignees

Labels

area/coreIssues related to User Interface, OS Support, Core Functionalitypriority/p1Important and should be addressed in the near term.
No fields configured for Feature.

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions