Skip to content

Gemini CLI OAuth broken on Windows (nvm) #41800

@hughcube

Description

@hughcube

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

  1. Install nvm for Windows (nvm4w)
  2. Install Node.js via nvm (e.g. nvm install 24.1.0)
  3. Install gemini-cli globally (npm i -g @anthropic-ai/gemini-cli or equivalent)
  4. 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.js file is found, credential extraction fails
  • Bug 2: Google API rejects the "WINDOWS" platform value with 400 error

Fix

PR #40729 addresses both issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions