{"record":{"id":"f25f6fe585d493ae","repo":"jackwener/OpenCLI","slug":"model-value-is-not-accepted-short-aliases","errorCode":null,"errorMessage":"--model \"${value}\" is not accepted. Short aliases like \"pro\", \"flash\", or \"flash-lite\" are not supported. Use a canonical model id (e.g. \"2.5-flash\"). Use \"opencli gemini models\" to list available values.","messagePattern":"--model \"(.+?)\" is not accepted\\. Short aliases like \"pro\", \"flash\", or \"flash-lite\" are not supported\\. Use a canonical model id \\(e\\.g\\. \"2\\.5-flash\"\\)\\. Use \"opencli gemini models\" to list available values\\.","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/gemini/ask.js","lineNumber":58,"sourceCode":"    }\n    for (const row of unwrapped) {\n        if (!row || typeof row.model !== 'string' || !Array.isArray(row.thinkingValues)) {\n            throw new CommandExecutionError('Gemini model discovery returned a malformed row');\n        }\n    }\n    return unwrapped;\n}\n\nfunction validateAskModelValue(value) {\n    if (!value) {\n        throw new ArgumentError(\n            '--model requires a canonical model id (e.g. \"2.5-flash\"). ' +\n            'Use \"opencli gemini models\" to list available values.'\n        );\n    }\n    // Reject short aliases like \"pro\", \"flash\", \"flash-lite\" that lack a version number.\n    if (!/\\d+\\.\\d+/.test(value)) {\n        throw new ArgumentError(\n            '--model \"' + value + '\" is not accepted. ' +\n            'Short aliases like \"pro\", \"flash\", or \"flash-lite\" are not supported. ' +\n            'Use a canonical model id (e.g. \"2.5-flash\"). ' +\n            'Use \"opencli gemini models\" to list available values.'\n        );\n    }\n    // Must match canonical format: X.Y-variant\n    if (!/^\\d+\\.\\d+-[a-z][a-z-]*$/.test(value)) {\n        throw new ArgumentError(\n            '--model \"' + value + '\" is not a valid canonical model id. ' +\n            'Expected format: version-variant (e.g. \"2.5-flash\", \"3.1-pro\"). ' +\n            'Use \"opencli gemini models\" to list available values.'\n        );\n    }\n}\n\nexport const __test__ = {\n    validateAskModelValue,","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/gemini/ask.js#L40-L76","documentation":"validateAskModelValue in clis/gemini/ask.js rejects `--model` values lacking a version number (regex `/\\d+\\.\\d+/`). Short aliases like `pro`, `flash`, or `flash-lite` are intentionally unsupported because they are ambiguous across Gemini versions. A canonical `version-variant` id is required.","triggerScenarios":"`opencli gemini ask --model flash` or `--model pro` / `--model flash-lite` — any value without a `X.Y` version component.","commonSituations":"Habit carried over from other CLIs or SDKs that accept short aliases; docs/blog snippets using bare model names; scripts parameterized with `MODEL=flash` from older tooling.","solutions":["Replace the alias with the canonical id, e.g. `--model 2.5-flash`, `--model 2.5-pro`, `--model 2.5-flash-lite`","Run `opencli gemini models` to map the alias to the current canonical id","Update wrapper scripts to store full canonical ids"],"exampleFix":"// before\nopencli gemini ask --model flash --prompt \"hi\"\n// after\nopencli gemini ask --model 2.5-flash --prompt \"hi\"","handlingStrategy":"validation","validationCode":"const CANONICAL_RE = /^\\d+\\.\\d+-[a-z][a-z-]*$/;\nif (['pro','flash','flash-lite'].includes(args.model) || !CANONICAL_RE.test(args.model)) {\n  throw new Error(`Use a canonical model id (e.g. 2.5-flash), got \"${args.model}\"`);\n}","typeGuard":"function isCanonicalModelId(v) {\n  return typeof v === 'string' && /^\\d+\\.\\d+-[a-z][a-z-]*$/.test(v);\n}","tryCatchPattern":"try {\n  await geminiAsk(args);\n} catch (err) {\n  if (err.name === 'ArgumentError' && err.message.includes('Short aliases')) {\n    const expanded = expandAlias(args.model); // flash -> 2.5-flash\n    if (expanded) return geminiAsk({ ...args, model: expanded });\n  }\n  throw err;\n}","preventionTips":["Never use bare aliases (pro/flash/flash-lite) in scripts","Maintain an alias->canonical map if you must accept short names","Validate model ids against /^\\d+\\.\\d+-[a-z][a-z-]*$/ before invoking","Refresh canonical ids periodically via `opencli gemini models`"],"tags":["argument-validation","cli","gemini"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}