jackwener/OpenCLI · error · CommandExecutionError
Trae CN model switch did not verify the requested model: req
Error message
Trae CN model switch did not verify the requested model: requested "${wanted}", current "${selectedLabel || 'unknown'}" What it means
After clicking the model item, selectTraeModel re-inspects the shell and compares the now-selected model label to the requested/expected normalized keys. If the UI still shows a different (or unknown) model, it throws this CommandExecutionError, meaning the click did not result in the desired selection.
Source
Thrown at clis/trae-cn/utils.js:739
? []
: models.filter((item) => normalizeModelLabel(item.Model).includes(wantedKey));
if (!exactMatch && containsMatches.length > 1) {
throw new ArgumentError(
`Model "${wanted}" is ambiguous in Trae CN model menu: ${containsMatches.map(item => item.Model).join(', ')}`,
);
}
const match = exactMatch || containsMatches[0];
if (!match) {
throw new ArgumentError(`Model "${wanted}" not found in Trae CN model menu`);
}
await page.click(TRAE_CN_MODEL_ITEM_SELECTOR, { nth: match.Index });
await page.wait(0.8);
const info = await page.evaluate(inspectTraeShellScript());
const selectedLabel = info.model || '';
const selectedKey = normalizeModelLabel(selectedLabel);
const matchKey = normalizeModelLabel(match.Model);
if (!selectedKey || (selectedKey !== matchKey && selectedKey !== wantedKey)) {
throw new CommandExecutionError(
`Trae CN model switch did not verify the requested model: requested "${wanted}", current "${selectedLabel || 'unknown'}"`,
'Open the Trae CN model menu and verify the requested model is selectable, then retry.',
);
}
return {
requested: wanted,
selected: selectedLabel,
workspace: info.workspace || '',
agent: info.agent || '',
};
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the selection; transient UI timing often succeeds on a second attempt
- Increase the wait after clicking before verification
- Select by a more specific/unique model name to reduce index ambiguity
- Verify manually in Trae CN that the model is selectable
Example fix
// before
await page.click(TRAE_CN_MODEL_ITEM_SELECTOR, { nth: match.Index });
await page.wait(0.8);
// after
await page.click(TRAE_CN_MODEL_ITEM_SELECTOR, { nth: match.Index });
await page.wait(2.0); Defensive patterns
Strategy: retry
Validate before calling
const info = await page.evaluate(inspectTraeShellScript());
if (info?.menuOpen) throw new SkipError('model menu still open; settle before verifying'); Type guard
const isModelVerified = (info, wanted, match) => {
const sel = normalizeModelLabel(info?.model || '');
return !!sel && (sel === normalizeModelLabel(match.Model) || sel === normalizeModelLabel(wanted));
}; Try / catch
try { await selectTraeModel(page, name); } catch (e) { if (e instanceof CommandExecutionError && /did not verify/.test(e.message)) { await page.wait(1.5); return selectTraeModel(page, name); } throw e; } Prevention
- Allow extra settle time after clicking before verification
- Retry once on verification failure (timing is a common cause)
- Prefer exact model names so the clicked row is unambiguous
When it happens
Trigger: Click landing on the wrong row after menu re-render (index drift), animation covering the item, the menu closing without selection, or the selected model label not yet updated when inspected after the 0.8s wait.
Common situations: Slow machines where 0.8s is not enough, Trae CN updates changing menu item ordering, or models whose displayed label differs from the menu label.
Related errors
- Could not find Antigravity input box
- Could not find input box
- Could not find antigravity.agentSidePanelInputBox
- Could not find Antigravity input box
- Timeout waiting for Antigravity reply after ${timeout / 1000
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e8085c7177eade81.
Report an issue: GitHub.