-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
Gemini CLI OAuth broken on Windows (nvm) #41800
Description
Bug Description
Gemini CLI OAuth is broken on Windows when gemini-cli is installed via nvm. Two independent bugs prevent setup from completing.
Bug 1: extractGeminiCliCredentials finds wrong oauth2.js
On Windows with nvm, gemini.cmd resolves (via realpathSync) to e.g. C:\Users\<user>\AppData\Local\nvm\v24.1.0\gemini.cmd. The first candidate path becomes the nvm root directory.
findFile with depth 10 then finds discord-api-types/payloads/v10/oauth2.js — a completely unrelated file. The code tries to extract credentials from this file, fails, and surfaces:
Error: Gemini CLI not found. Install it first: brew install gemini-cli
Bug 2: resolvePlatform returns "WINDOWS" which Google API rejects
resolvePlatform() returns "WINDOWS" on win32, but Google's loadCodeAssist API does not accept it as a valid Platform enum value. All three endpoints respond with 400 INVALID_ARGUMENT.
Steps to Reproduce
- Install nvm for Windows (nvm4w)
- Install Node.js via nvm (e.g.
nvm install 24.1.0) - Install gemini-cli globally (
npm i -g @anthropic-ai/gemini-clior equivalent) - Attempt to use Gemini CLI OAuth in openclaw
Expected Behavior
OAuth setup completes successfully and Gemini CLI works on Windows.
Actual Behavior
- Bug 1: Wrong
oauth2.jsfile is found, credential extraction fails - Bug 2: Google API rejects the
"WINDOWS"platform value with 400 error
Fix
PR #40729 addresses both issues.