jackwener/OpenCLI · error · ArgumentError

--thinking '${thinkingValue}' is not currently available

Error message

--thinking '${thinkingValue}' is not currently available

What it means

An ArgumentError from the union fallback: when the target model could not be identified, the library validates --thinking against the union of all discovered thinking values, and rejects the value if it is not in that set.

Source

Thrown at clis/gemini/ask.js:236

            // thinking values; otherwise fall back to the union across all models.
            const targetModelThinking =
                targetModelId && modelThinkingMap.has(targetModelId)
                    ? modelThinkingMap.get(targetModelId)
                    : null;

            if (targetModelThinking) {
                // Scoped to the target model.
                if (!targetModelThinking.includes(thinkingValue)) {
                    const availableForModel = targetModelThinking.sort().join(', ');
                    throw new ArgumentError(
                        `--thinking '${thinkingValue}' is not available for the ${hasModel ? 'selected' : 'current'} model ('${targetModelId}')`,
                        `Model '${targetModelId}' supports: ${availableForModel}. Run \`opencli gemini models\` for all models.`,
                    );
                }
            } else if (allThinking.size > 0 && !allThinking.has(thinkingValue)) {
                // Union fallback when the target model cannot be identified.
                const availableList = [...allThinking].sort().join(', ');
                throw new ArgumentError(
                    `--thinking '${thinkingValue}' is not currently available`,
                    `Available thinking values: ${availableList}. Run \`opencli gemini models\` for details.`,
                );
            }

            // Select the requested thinking level before snapshot.
            const selected = await selectGeminiThinking(page, thinkingValue);
            if (!selected) {
                // Build an informative hint from what we know.
                const hintParts = [];
                if (targetModelThinking && targetModelThinking.length > 0) {
                    hintParts.push(`Model '${targetModelId}' supports: ${targetModelThinking.sort().join(', ')}.`);
                } else if (allThinking.size > 0) {
                    hintParts.push(`Available thinking values: ${[...allThinking].sort().join(', ')}.`);
                }
                hintParts.push('Run `opencli gemini models` for details.');
                throw new ArgumentError(
                    `Could not select thinking level '${thinkingValue}' in the Gemini web UI`,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Use one of the values printed in the hint (Available thinking values: ...) exactly
  2. Run `opencli gemini models` for the canonical list of thinking values
  3. Pass an explicit --model so per-model validation applies instead of the union fallback
  4. Fix casing/typo in the --thinking value

Example fix

// before
opencli gemini ask --thinking maximum
// after
opencli gemini ask --thinking high  # from: opencli gemini models
Defensive patterns

Strategy: validation

Validate before calling

const models = await getGeminiModels();
const all = new Set(models.flatMap(m => m.thinking || []));
if (!all.has(thinkingValue)) {
  throw new Error(`Available thinking values: ${[...all].sort().join(', ')}`);
}

Try / catch

try {
  await ask({ thinking });
} catch (e) {
  if (/is not currently available/.test(e.message)) {
    console.error('Use one of the values from: opencli gemini models');
  } else throw e;
}

Prevention

When it happens

Trigger: targetModelThinking is null/unidentified, allThinking is non-empty, and `!allThinking.has(thinkingValue)` at clis/gemini/ask.js:236.

Common situations: Typo in --thinking (e.g. 'hight' instead of 'high'); passing a value from a different CLI; discovery couldn't map the current/target model so only the union check applies.

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/c74f7a6242ab33ba. Report an issue: GitHub.