jackwener/OpenCLI · error · CommandExecutionError
Could not enable Adaptive thinking
Error message
Could not enable Adaptive thinking
What it means
When --think is enabled, setAdaptiveThinking() must flip the Adaptive thinking toggle. If it returns {ok:false} after retries, the library throws CommandExecutionError because the requested thinking mode could not be enabled.
Source
Thrown at clis/claude/ask.js:102
}
const modelResult = await withRetry(() => selectModel(page, wantModel));
if (!modelResult?.ok) {
if (modelResult?.upgrade) {
throw new ArgumentError(
`${wantModel} model requires a paid Claude plan.`,
'Pick --model sonnet or --model haiku, or upgrade your account.',
);
}
throw new CommandExecutionError(`Could not switch to ${wantModel} model`);
}
// Post-toggle settle dropped — the next CDP eval (setAdaptiveThinking) gives
// React enough time to flush aria-checked updates between rountrips.
}
const thinkResult = await withRetry(() => setAdaptiveThinking(page, wantThink));
if (!thinkResult?.ok && wantThink) {
throw new CommandExecutionError('Could not enable Adaptive thinking');
}
// Post-toggle settle dropped — the next CDP eval (sendMessage / sendWithFile)
// gives React enough time to flush aria-checked updates.
if (kwargs.file) {
const baseline = await withRetry(() => getBubbleCount(page));
try {
const fileResult = await sendWithFile(page, kwargs.file, prompt);
if (fileResult && !fileResult.ok) {
throw new CommandExecutionError(fileResult.reason || 'Failed to attach file');
}
} catch (err) {
// SPA navigates after send; "Promise was collected" means send succeeded
if (!String(err?.message || err).includes('Promise was collected')) throw err;
}
// Pre-waitForResponse settle dropped — waitForResponse's first 3 s polling
// tick covers the same window without an unconditional sleep.
const result = await waitForResponse(page, baseline, prompt, timeoutMs);View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command to give the page more time to render the toggle.
- Drop --think if the current model/plan doesn't offer Adaptive thinking.
- Update opencli if the toggle markup changed in a Claude UI update.
Example fix
// before opencli claude ask "solve this" --think --model haiku // after opencli claude ask "solve this" --model sonnet --think # model supporting adaptive thinking
Defensive patterns
Strategy: fallback
Validate before calling
// Only request --think for models/plans that expose the toggle const supportsThinking = ['sonnet', 'opus'].includes(opts.model); if (!supportsThinking) delete opts.think;
Try / catch
try {
return await opencli.claude.ask(prompt, { think: true, model: 'sonnet', new: true });
} catch (e) {
if (/Could not enable Adaptive thinking/.test(e.message)) {
return await opencli.claude.ask(prompt, { model: 'sonnet', new: true }); // retry without --think
}
throw e;
} Prevention
- Use --think only with models that support adaptive thinking.
- Treat --think as best-effort: fall back to a non-thinking run.
- Update opencli when Claude changes the toggle markup.
When it happens
Trigger: Running `claude ask ... --think` where the Adaptive thinking toggle is absent from the DOM, already in a conflicting state, or not clickable within retries; wantThink is true and thinkResult.ok is false.
Common situations: Plan or model that doesn't support adaptive thinking (toggle hidden); Claude UI change moving/removing the toggle; page not fully hydrated when the toggle is clicked.
Related errors
- Unexpected 12306 probe: ${JSON.stringify(probe)}
- Waiting for 12306 tk auth cookie
- amazon.com
- Unexpected Amazon probe: ${JSON.stringify(probe)}
- amazon ${action} navigation lost the current browser target
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/4511cc157229086a.
Report an issue: GitHub.