gemini-cli - 💡(How to fix) Fix [Bug] Agent mode stuck in infinite crash loop due to corrupted oauth_creds.json (Windows)

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…

Error Message

Instead of prompting the user to re-authenticate or gracefully clearing the invalid token, the authentication flow falls back to attempting to hit the GCP metadata server (169.254.169.254). Since this is a local Windows machine and not a GCP instance, it fails repeatedly with a COMPUTE_ADC failed error, completely breaking the Agent mode.

Fix Action

Fix / Workaround

Workaround / Fix: Manually navigating to %USERPROFILE%.gemini, deleting the oauth_creds.json file, and restarting VS Code forces a fresh token generation flow, which instantly resolves the issue and restores Agent functionality.

RAW_BUFFERClick to expand / collapse

This issue is similar to an existing critical issue on MacOS: https://github.com/google-gemini/gemini-cli/issues/23039

Description: When using the Gemini Code Assist Agent mode on Windows, the extension can get stuck in an infinite crash and restart loop. This occurs when the local authentication token (oauth_creds.json located in %USERPROFILE%.gemini) becomes corrupted or invalid (invalid_grant).

Instead of prompting the user to re-authenticate or gracefully clearing the invalid token, the authentication flow falls back to attempting to hit the GCP metadata server (169.254.169.254). Since this is a local Windows machine and not a GCP instance, it fails repeatedly with a COMPUTE_ADC failed error, completely breaking the Agent mode.

Environment:

Environment:

OS: Windows_NT x64 10.0.26200

VS Code Version: 1.119.0 (system setup)

Node.js: 22.22.1 / Electron: 39.8.8

Extension/CLI-version: Google Gemini Code Assist (google.geminicodeassist) v2.81.0

Steps to Reproduce:

Have an expired or corrupted oauth_creds.json file in the %USERPROFILE%.gemini\ directory.

Launch VS Code and attempt to use/start the Gemini Agent mode.

Observe the Extension Host / Agent logs.

Expected Behavior: The extension should detect the invalid_grant or corrupted file, halt the background process gracefully, and prompt the user in the UI to log in again.

Actual Behavior: The Agent background process crashes and restarts infinitely. The dev logs show it trying to reach 169.254.169.254: FatalAuthenticationError: COMPUTE_ADC failed: Could not authenticate using metadata server application default credentials... network timeout at: http://169.254.169.254/...

Workaround / Fix: Manually navigating to %USERPROFILE%.gemini, deleting the oauth_creds.json file, and restarting VS Code forces a fresh token generation flow, which instantly resolves the issue and restores Agent functionality.

Originally posted by @Elounia in #23039

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