Skip to content

fix(auth): don't crash when initial auth fails#17308

Merged
skeshive merged 4 commits into
mainfrom
fix-bug-auth
Jan 22, 2026
Merged

fix(auth): don't crash when initial auth fails#17308
skeshive merged 4 commits into
mainfrom
fix-bug-auth

Conversation

@skeshive

@skeshive skeshive commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

TLDR

This change prevents Gemini CLI from crashing if the initial authentication fails at startup. Instead of exiting the process, the application will now continue to run, allowing the UI to display an appropriate error message / the user to switch auth types.

Linked Issues

Fixes #17300, Fixes #17225

@skeshive skeshive requested a review from a team as a code owner January 22, 2026 15:46
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @skeshive, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the Gemini CLI by refactoring its initial authentication error handling. The change ensures that the application no longer terminates abruptly upon an authentication failure, thereby improving the user experience by allowing the interface to remain active and inform the user of the issue gracefully.

Highlights

  • Authentication Error Handling: The pull request modifies the initial authentication logic to prevent the application from crashing when authentication fails. Previously, an authentication error would trigger an immediate process exit.
  • Application Resilience: Instead of exiting, the application will now log the authentication error and continue execution, allowing the UI to display an appropriate error message to the user.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@skeshive skeshive enabled auto-merge January 22, 2026 15:50
@github-actions

github-actions Bot commented Jan 22, 2026

Copy link
Copy Markdown

Size Change: +106 B (0%)

Total Size: 23.2 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 23.2 MB +106 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to prevent the CLI from crashing on initial authentication failure. While the intent is good, the current implementation in non-interactive mode can lead to incorrect behavior by allowing the process to continue and potentially exit with a success code even after an auth failure. I've suggested a change to ensure that authentication errors are always handled as fatal errors, while still allowing for proper error formatting (e.g., as JSON).

Comment thread packages/cli/src/gemini.tsx
@gemini-cli gemini-cli Bot added priority/p1 Important and should be addressed in the near term. area/security Issues related to security labels Jan 22, 2026
@skeshive skeshive added this pull request to the merge queue Jan 22, 2026
Merged via the queue into main with commit 87a0db2 Jan 22, 2026
25 checks passed
@skeshive skeshive deleted the fix-bug-auth branch January 22, 2026 16:55
@skeshive

Copy link
Copy Markdown
Contributor Author

/patch

@github-actions

Copy link
Copy Markdown

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: stable,preview
  • Commit: 87a0db20d2738b2cb51bb61814dd55c6bb725a7b
  • Workflows Created: 2

🔗 Track Progress:

github-actions Bot pushed a commit that referenced this pull request Jan 22, 2026
# Conflicts:
#	packages/cli/src/gemini.tsx
@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. ⚠️ Resolve conflicts in the hotfix PR first: #17316
  2. Test your changes after resolving conflicts
  3. Once merged, the patch release will automatically trigger
  4. You'll receive updates here when the release completes

🔗 Track Progress:

github-actions Bot pushed a commit that referenced this pull request Jan 22, 2026
# Conflicts:
#	packages/cli/src/gemini.tsx
@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. ⚠️ Resolve conflicts in the hotfix PR first: #17317
  2. Test your changes after resolving conflicts
  3. Once merged, the patch release will automatically trigger
  4. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch Release Started!

📋 Release Details:

  • Environment: prod
  • Channel: preview → publishing to npm tag preview
  • Version: v0.26.0-preview.1
  • Hotfix PR: Merged ✅
  • Release Branch: release/v0.26.0-preview.1-pr-17308

⏳ Status: The patch release is now running. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch Release Started!

📋 Release Details:

  • Environment: prod
  • Channel: stable → publishing to npm tag latest
  • Version: v0.25.0
  • Hotfix PR: Merged ✅
  • Release Branch: release/v0.25.0-pr-17308

⏳ Status: The patch release is now running. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

Patch Release Complete!

📦 Release Details:

🎉 Status: Your patch has been successfully released and published to npm!

📝 What's Available:

🔗 Links:

@github-actions

Copy link
Copy Markdown

Patch Release Complete!

📦 Release Details:

  • Version: 0.25.1
  • NPM Tag: latest
  • Channel: stable
  • Dry Run: false

🎉 Status: Your patch has been successfully released and published to npm!

📝 What's Available:

🔗 Links:

thacio added a commit to thacio/auditaria that referenced this pull request Jan 24, 2026
sidwan02 pushed a commit to sidwan02/gemini-cli-gemma that referenced this pull request Feb 6, 2026
kuishou68 pushed a commit to iOfficeAI/gemini-cli-pro that referenced this pull request Feb 27, 2026
@sripasg sripasg added the size/s A small PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/security Issues related to security priority/p1 Important and should be addressed in the near term. size/s A small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CLI crash loop on startup after failed "Login with Google" (ProjectIdRequiredError) Authentication error

3 participants