mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-19 10:52:49 +00:00
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