Environment
- OS: Windows 11 with WSL2 Ubuntu 24.04
- Node.js: v22.17.0
- Gemini CLI version: v0.39.1 (npm global install)
- Auth mode:
oauth-personal (Google One AI Ultra subscription)
- Shell: bash (WSL2)
Summary
After weeks of production use of gemini-cli in WSL2 for autonomous agentic workflows (--yolo mode), we encountered a cascading series of bugs that collectively make the CLI unreliable for WSL2 development. Each fix reveals the next. This documents 5 confirmed bugs.
Bug 1: OAuth Session Silently Invalidates
Symptom: Failed to sign in: Cloud Code Private API not enabled drops into interactive auth menu, blocking automation.
Root cause:
~/.gemini/google_accounts.json shows "active": null after silent token drop
~/.gemini/projects.json accumulated corrupt entry "/mnt/c": "c" from a session launched from Windows-mounted path — binding workspace to wrong GCP project
Fix: Background token refresh + prune stale projects.json + gemini auth reset command
Bug 2: Hook Schema Silent Breaking Change in v0.39.1
Symptom: Error in: hooks.AfterAgent[0] Expected object, received string on every startup.
Root cause (confirmed by reading bundle source chunk-WFCK2Z32.js):
Old valid format (now silently discarded):
"hooks": { "SessionStart": ["echo 'hello'"] }
New required Zod schema:
"hooks": { "SessionStart": [{ "hooks": [{ "type": "command", "command": "echo 'hello'" }] }] }
No auto-migration, no docs update, error message doesn't show correct format. Hooks are silently discarded via debugLogger.warn (invisible to user).
Bug 3: EPIPE Crash on AfterAgent Hook
Symptom: Error: write EPIPE at writeToStdout — CLI crashes after every agent turn.
Even nohup ... >/dev/null 2>&1 & doesn't prevent it. Hook subprocess inherits parent stdout during teardown.
Fix: Execute AfterAgent hooks in fully detached subprocess (new process group).
Bug 4: Untrusted Workspace Warning Blocks --yolo Mode
Interactive trust prompt appears even with --yolo flag. security.folderTrust.enabled: false does not suppress it. Fundamental regression for YOLO-mode users.
Bug 5: /mnt/c/ Path Corrupts projects.json
Launching CLI from Windows-mounted path creates stale "/mnt/c": "c" in projects.json that causes Cloud Code API errors in future sessions.
Comparative Observation
Running Claude Sonnet 4.6 in the identical WSL2 environment with identical hooks/configs produces zero warnings, zero EPIPE crashes, zero session loss, and consistent YOLO-mode automation. This isolates the issues to Gemini CLI's WSL2 integration layer specifically.
Environment
oauth-personal(Google One AI Ultra subscription)Summary
After weeks of production use of
gemini-cliin WSL2 for autonomous agentic workflows (--yolomode), we encountered a cascading series of bugs that collectively make the CLI unreliable for WSL2 development. Each fix reveals the next. This documents 5 confirmed bugs.Bug 1: OAuth Session Silently Invalidates
Symptom:
Failed to sign in: Cloud Code Private API not enableddrops into interactive auth menu, blocking automation.Root cause:
~/.gemini/google_accounts.jsonshows"active": nullafter silent token drop~/.gemini/projects.jsonaccumulated corrupt entry"/mnt/c": "c"from a session launched from Windows-mounted path — binding workspace to wrong GCP projectFix: Background token refresh + prune stale projects.json +
gemini auth resetcommandBug 2: Hook Schema Silent Breaking Change in v0.39.1
Symptom:
Error in: hooks.AfterAgent[0] Expected object, received stringon every startup.Root cause (confirmed by reading bundle source
chunk-WFCK2Z32.js):Old valid format (now silently discarded):
New required Zod schema:
No auto-migration, no docs update, error message doesn't show correct format. Hooks are silently discarded via
debugLogger.warn(invisible to user).Bug 3: EPIPE Crash on AfterAgent Hook
Symptom:
Error: write EPIPE at writeToStdout— CLI crashes after every agent turn.Even
nohup ... >/dev/null 2>&1 &doesn't prevent it. Hook subprocess inherits parent stdout during teardown.Fix: Execute AfterAgent hooks in fully detached subprocess (new process group).
Bug 4: Untrusted Workspace Warning Blocks --yolo Mode
Interactive trust prompt appears even with
--yoloflag.security.folderTrust.enabled: falsedoes not suppress it. Fundamental regression for YOLO-mode users.Bug 5: /mnt/c/ Path Corrupts projects.json
Launching CLI from Windows-mounted path creates stale
"/mnt/c": "c"in projects.json that causes Cloud Code API errors in future sessions.Comparative Observation
Running Claude Sonnet 4.6 in the identical WSL2 environment with identical hooks/configs produces zero warnings, zero EPIPE crashes, zero session loss, and consistent YOLO-mode automation. This isolates the issues to Gemini CLI's WSL2 integration layer specifically.