Gemini CLI PR Fixes Preview Model 404 Errors with Stable Fallback
alarcritty · ghdev · 2026-08-01
This PR addresses an issue in Gemini CLI where API key authentication users experienced 404 errors when accessing preview models.
- Background: The system previously assumed all API keys had preview model access. When a key lacking this access called gemini-3.1-pro-preview, it returned a 404 error. The fallback policy would then attempt another preview model, causing a second 404 and displaying an irrelevant admin prompt.
- Fix: The handleFallback logic now detects when a preview model throws a 404 on the API key path. It flags the key as lacking preview access and automatically resolves fallback candidates to stable models (gemini-2.5-pro and gemini-2.5-flash), showing an API-key-specific error message.
- Testing: New unit tests cover access downgrades, OAuth auth, non-preview models, and non-404 errors. End-to-end simulations confirm the CLI successfully recovers using stable models instead of crashing.
More from coding & agent
- 'LLM code is sloppy' rebutted with real ffmpeg code: identical if/else branches in a top library — kingslyj · 2026-10-16
- Office-editing tool calls need file, worktree and unit: lessons from dsh-univer-office — FunDistribution6537 · 2026-10-16
- Architect MD workflow: Gemini one-shot outputs that beat Opus, via 5-lens plan critique — oikk01 · 2026-10-16
- Prove a coding agent actually ran the tests: check artifacts, not approvals — ComprehensiveShake76 · 2026-10-16
- Building an acceptance harness for AI spreadsheet edits: allowlists, recalc checks, idempotency — ukdicha-modakkk · 2026-10-16
- Agent actions need checks outside the model: NVIDIA demos lean on guardrails amid wave of real agent incidents — Creamy-And-Crowded · 2026-10-16