gemini-cli - 💡(How to fix) Fix [Bug]: Failed to sign in throws raw HTML error related to Google's "automated queries" protection [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25288Fetched 2026-04-14 05:56:13
View on GitHub
Comments
3
Participants
3
Timeline
8
Reactions
3
Author
Timeline (top)
commented ×3labeled ×3closed ×1subscribed ×1

Error Message

When attempting to sign in using the CLI, the process fails and outputs a raw HTML page to the console instead of completing the authentication or returning a handled error. The CLI should gracefully catch this non-JSON/HTML response from Google's servers. Instead of crashing or dumping raw HTML into the terminal, it should display a clean, human-readable error message (e.g., "Sign-in failed: Google blocked the request due to potential automated queries. Please try again later or switch your network."). The core issue here isn't the network block itself (which is on Google's end), but rather the lack of error handling in the CLI for unexpected HTML responses during the authentication flow.

Code Example

> /about
# paste output here
RAW_BUFFERClick to expand / collapse

What happened?

When attempting to sign in using the CLI, the process fails and outputs a raw HTML page to the console instead of completing the authentication or returning a handled error.

The HTML response is Google's standard "We're sorry..." block page, which indicates that the network might be sending automated queries (rate-limiting/anti-bot protection).

Failed to sign in. Message: <html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>Sorry...</title><style> body { font-family: verdana, arial, sans-serif; background-color: #fff; color: #000; }</style></head><body><div><table><tr><td><b><font face=sans-serif size=10><font color=#4285f4>G</font><font color=#ea4335>o</font><font color=#fbbc05>o</font><font color=#4285f4>g</font><font color=#34a853>l</font><font color=#ea4335>e</font></font></b></td><td style="text-align: left; vertical-align: bottom; padding-bottom: 15px; width: 50%"><div style="border-bottom: 1px solid #dfdfdf;">Sorry...</div></td></tr></table></div><div style="margin-left: 4em;"><h1>We're sorry...</h1><p>... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.</p></div><div style="margin-left: 4em;">See <a href="https://support.google.com/websearch/answer/86640">Google Help</a> for more information.<br/><br/></div><div style="text-align: center; border-top: 1px solid #dfdfdf;"><a href="https://www.google.com">Google Home</a></div></body></html>

What did you expect to happen?

The CLI should gracefully catch this non-JSON/HTML response from Google's servers. Instead of crashing or dumping raw HTML into the terminal, it should display a clean, human-readable error message (e.g., "Sign-in failed: Google blocked the request due to potential automated queries. Please try again later or switch your network.").

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
# paste output here

CLI Version 0.37.1 │ │ Git Commit 3b2d4f100 │ │ Model gemini-3-flash-preview │ │ Sandbox no sandbox │ │ OS darwin │ │ Auth Method Sign in with Google

</details>

Login information

Used the standard sign-in command (e.g., gemini login).

Anything else we need to know?

The core issue here isn't the network block itself (which is on Google's end), but rather the lack of error handling in the CLI for unexpected HTML responses during the authentication flow.

extent analysis

TL;DR

The CLI should be updated to handle non-JSON responses, such as the HTML block page from Google, and display a user-friendly error message instead of crashing or dumping raw HTML.

Guidance

  • Verify the current error handling mechanism in the CLI to understand why it's not catching the HTML response.
  • Implement a check for non-JSON responses during the authentication flow and handle them accordingly.
  • Consider adding a retry mechanism with a delay to handle temporary rate-limiting issues.
  • Review the authentication flow to ensure it's not triggering Google's anti-bot protection unnecessarily.

Example

No code example is provided as the issue lacks specific implementation details, but a potential solution could involve checking the response content type and handling HTML responses separately.

Notes

The root cause of the issue is the lack of proper error handling in the CLI, rather than the network block itself. The solution should focus on improving the CLI's robustness and user experience.

Recommendation

Apply a workaround by implementing better error handling in the CLI to catch and handle non-JSON responses, as the issue is not with the network block but with the CLI's ability to handle unexpected responses.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING