Files
gemini-cli[bot] 45d35ff440 fix(core): fall back to default model for invalid Gemini model IDs
This PR implements a validation check in `resolveModel` to ensure that Gemini model IDs are valid before use.

### Problem
Outdated or non-existent Gemini model IDs (like `gemini-pro-latest`) can get persisted in a user's `settings.json` if they were ever used or resolved in previous CLI versions. On subsequent startups, the CLI picks this invalid model from settings, leading to "model not supported" API errors.

### Solution
Modified `resolveModel` in `packages/core/src/config/models.ts` to verify if a Gemini model ID (starting with `gemini-`) is in the `VALID_GEMINI_MODELS` set. If it's not, the function now falls back to `DEFAULT_GEMINI_MODEL`.

Custom (non-Gemini) model IDs are still allowed and returned as-is to maintain flexibility for proxies and other providers.

Fixes: #26971

cc @kevinjwang1
2026-05-15 20:51:44 +00:00
..