jackwener/OpenCLI · error · ArgumentError
--model "${value}" is not accepted. Short aliases like "pro"
Error message
--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. What it means
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.
Source
Thrown at clis/gemini/ask.js:58
}
for (const row of unwrapped) {
if (!row || typeof row.model !== 'string' || !Array.isArray(row.thinkingValues)) {
throw new CommandExecutionError('Gemini model discovery returned a malformed row');
}
}
return unwrapped;
}
function validateAskModelValue(value) {
if (!value) {
throw new ArgumentError(
'--model requires a canonical model id (e.g. "2.5-flash"). ' +
'Use "opencli gemini models" to list available values.'
);
}
// Reject short aliases like "pro", "flash", "flash-lite" that lack a version number.
if (!/\d+\.\d+/.test(value)) {
throw new ArgumentError(
'--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.'
);
}
// Must match canonical format: X.Y-variant
if (!/^\d+\.\d+-[a-z][a-z-]*$/.test(value)) {
throw new ArgumentError(
'--model "' + value + '" is not a valid canonical model id. ' +
'Expected format: version-variant (e.g. "2.5-flash", "3.1-pro"). ' +
'Use "opencli gemini models" to list available values.'
);
}
}
export const __test__ = {
validateAskModelValue,View on GitHub (pinned to 49907e53dc)
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
Example fix
// before opencli gemini ask --model flash --prompt "hi" // after opencli gemini ask --model 2.5-flash --prompt "hi"
Defensive patterns
Strategy: validation
Validate before calling
const CANONICAL_RE = /^\d+\.\d+-[a-z][a-z-]*$/;
if (['pro','flash','flash-lite'].includes(args.model) || !CANONICAL_RE.test(args.model)) {
throw new Error(`Use a canonical model id (e.g. 2.5-flash), got "${args.model}"`);
} Type guard
function isCanonicalModelId(v) {
return typeof v === 'string' && /^\d+\.\d+-[a-z][a-z-]*$/.test(v);
} Try / catch
try {
await geminiAsk(args);
} catch (err) {
if (err.name === 'ArgumentError' && err.message.includes('Short aliases')) {
const expanded = expandAlias(args.model); // flash -> 2.5-flash
if (expanded) return geminiAsk({ ...args, model: expanded });
}
throw err;
} Prevention
- 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`
When it happens
Trigger: `opencli gemini ask --model flash` or `--model pro` / `--model flash-lite` — any value without a `X.Y` version component.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- --model requires a canonical model id (e.g. "2.5-flash"). Us
- --model "${value}" is not a valid canonical model id. Expect
- --thinking must be 'standard' or 'extended', got '${thinking
- <train-no> "${trainNo}" does not look like a 12306 internal
- --from station must not be empty
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f25f6fe585d493ae.
Report an issue: GitHub.