{"record":{"id":"eb5ce229d5d5bd85","repo":"jackwener/OpenCLI","slug":"unknown-model-modelvalue-available-models","errorCode":null,"errorMessage":"Unknown model \"${modelValue}\". Available models: ${availableIds.join(', ')}. Use \"opencli gemini models\" to see available values.","messagePattern":"Unknown model \"(.+?)\"\\. Available models: (.+?)\\. Use \"opencli gemini models\" to see available values\\.","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/gemini/ask.js","lineNumber":178,"sourceCode":"\n            // Close the menu. Thinking support is intentionally not copied from\n            // the currently-visible UI into every model row: Gemini exposes\n            // thinking controls for the current selection, not a reliable\n            // per-model capability matrix.\n            await page.evaluate(`(() => { try { document.body.click(); } catch (_) {} })()`);\n        }\n\n        // ── Model selection ──────────────────────────────────────────────\n        if (hasModel) {\n            const availableModels = discoveredModels || [];\n            if (!Array.isArray(availableModels) || availableModels.length === 0) {\n                throw new CommandExecutionError(\n                    'Gemini model discovery returned no selectable models. Gemini Web may have changed its model selector UI.'\n                );\n            }\n            const availableIds = availableModels.map((m) => m?.model).filter(Boolean);\n            if (!availableIds.includes(modelValue)) {\n                throw new ArgumentError(\n                    'Unknown model \"' + modelValue + '\". ' +\n                    'Available models: ' + availableIds.join(', ') + '. ' +\n                    'Use \"opencli gemini models\" to see available values.'\n                );\n            }\n            await selectGeminiModel(page, modelValue);\n        }\n\n        // ── Thinking validation and selection ──────────────────────────\n        if (hasThinking) {\n            // Reuse the pre-discovered models from the shared discovery call.\n            const discovered = discoveredModels || [];\n\n            // When --model was supplied, scope thinking to the selected model;\n            // otherwise scope to the current model from the web UI.\n            let targetModelId;\n            if (hasModel) {\n                targetModelId = modelValue;","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/gemini/ask.js#L160-L196","documentation":"An ArgumentError raised when the user passes a --model value that is not among the model IDs discovered from the Gemini Web UI. The error lists all valid IDs and points to `opencli gemini models`.","triggerScenarios":"`availableIds.includes(modelValue)` is false, e.g. `opencli gemini ask --model nonexistent-model`.","commonSituations":"Typo in model name; using an old model ID after Gemini renamed/retired it; casing mismatch; copying an ID from a different product (AI Studio vs Gemini Web).","solutions":["Run `opencli gemini models` and copy an ID exactly from the printed list","Fix spelling/casing of the --model value to match a discovered ID","Re-run discovery if Gemini recently renamed models (available IDs come from the live UI)"],"exampleFix":"// before\nopencli gemini ask --model gemini-1.5-pro\n// after\nopencli gemini ask --model \"2.5 Pro\"   # ID exactly as listed by: opencli gemini models","handlingStrategy":"validation","validationCode":"const models = await getGeminiModels();\nconst ids = models.map(m => m.model);\nif (!ids.includes(modelValue)) {\n  throw new Error(`Unknown model \"${modelValue}\". Available: ${ids.join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await ask({ model: modelValue });\n} catch (e) {\n  if (/Unknown model/.test(e.message)) console.error(e.message + '\\nRun: opencli gemini models');\n  else throw e;\n}","preventionTips":["Always copy model IDs from `opencli gemini models` output","Refresh the model list after Gemini renames models","Validate --model against discovered IDs before invoking","Watch for casing differences in IDs"],"tags":["argument-validation","gemini","invalid-model"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}