jackwener/OpenCLI · error · ArgumentError

--thinking '${thinkingValue}' is not available for the ${has

Error message

--thinking '${thinkingValue}' is not available for the ${hasModel ? 'selected' : 'current'} model ('${targetModelId}')

What it means

An ArgumentError raised when the requested --thinking value is valid in general but not supported by the specific target model. Discovery records per-model thinking options; if the target model's list excludes the value, this scoped error fires with a hint about supported values.

Source

Thrown at clis/gemini/ask.js:228

                    }
                }
            }

            // Resolve thinkingValue from early validation.
            const thinkingValue = String(kwargs.thinking ?? '').trim().toLowerCase();

            // Validate: if we can identify the target model, scope to its
            // 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 = [];

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pick a --thinking value listed for that model (the hint shows supported values: e.g. high/low)
  2. Run `opencli gemini models` to see per-model thinking support before passing --thinking
  3. Omit --thinking to use the model's default
  4. Choose a different --model that supports the desired thinking level

Example fix

// before
opencli gemini ask --model "2.5 Flash" --thinking deep-think
// after
opencli gemini ask --model "2.5 Flash" --thinking low  # value from: opencli gemini models
Defensive patterns

Strategy: validation

Validate before calling

const models = await getGeminiModels();
const target = models.find(m => m.model === modelValue);
if (target?.thinking && !target.thinking.includes(thinkingValue)) {
  throw new Error(`Model '${modelValue}' supports: ${target.thinking.sort().join(', ')}`);
}

Try / catch

try {
  await ask({ model, thinking });
} catch (e) {
  if (/is not available for the .* model/.test(e.message)) {
    console.error(e.hint || e.message); // retry without --thinking or with a listed value
  } else throw e;
}

Prevention

When it happens

Trigger: targetModelThinking exists and is non-empty but `!targetModelThinking.includes(thinkingValue)`, e.g. `--thinking 2.5-pro --thinking-level low` on a model that only exposes 'high'.

Common situations: Requesting a thinking level a lighter model doesn't offer; model supports fewer thinking options than the union of all models; stale local knowledge of which models support thinking.

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/8fca2a19b20bd0dd. Report an issue: GitHub.