{"record":{"id":"18a06df6a9f94872","repo":"jackwener/OpenCLI","slug":"no-model-matched-name","errorCode":null,"errorMessage":"No model matched: '${name}'","messagePattern":"No model matched: '(.+?)'","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/trae-solo/model.js","lineNumber":88,"sourceCode":"        return { ok: true, labels };\n      })()`);\n\n            if (!stage1.ok) {\n                throw new CommandExecutionError(stage1.reason, stage1.detail || '');\n            }\n\n            if (listOnly) {\n                try { await page.evaluate('document.body.click()'); } catch {}\n                return stage1.labels.map((m) => ({ Status: m === current ? 'Active' : 'Available', Model: m }));\n            }\n\n            // Stage 2 (page.click): use real CDP Input.dispatchMouseEvent —\n            // Trae's model menu items don't fire React onSelect from synthetic\n            // pointer events alone. Match by nth-of-type derived from labels.\n            const idx = stage1.labels.findIndex((l) => l.toLowerCase().includes(name));\n            if (idx < 0) {\n                try { await page.evaluate('document.body.click()'); } catch {}\n                throw new CommandExecutionError(\n                    `No model matched: '${name}'`,\n                    'available=' + JSON.stringify(stage1.labels),\n                );\n            }\n            const chosenLabel = stage1.labels[idx];\n            const clickSelector = `.core-model-select-model-item[role=\"option\"]:nth-of-type(${idx + 1})`;\n            try {\n                await page.click(clickSelector);\n            } catch (err) {\n                // Some Trae model rows wrap option in another element; fall back\n                // to JS dispatch on the nth visible option.\n                const fallbackClicked = await page.evaluate(`(function(i) {\n          const opts = Array.from(document.querySelectorAll('.core-model-select-model-item[role=\"option\"]'))\n            .filter((el) => el.offsetParent);\n          const target = opts[i];\n          if (!target) return false;\n          const r = target.getBoundingClientRect();\n          const init = { bubbles: true, cancelable: true, button: 0, buttons: 1,","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-solo/model.js#L70-L106","documentation":"This error is thrown by the trae-solo `model` command when the model-switch name argument does not case-insensitively match any option label in Trae's opened model dropdown. The command first enumerates visible `.core-model-select-model-item[role=\"option\"]` labels via page.evaluate, then finds an index whose label contains the requested substring; if findIndex returns -1 it closes the menu and throws CommandExecutionError, attaching the list of available labels as the detail. It exists to fail fast with actionable context instead of clicking an undefined option.","triggerScenarios":"Calling `model <name>` where <name> is a substring not contained in any currently rendered model menu label — e.g. misspelling, wrong casing assumptions beyond case-insensitivity, a model not provisioned in this Trae workspace, or the menu rendering a truncated/renamed label set.","commonSituations":"Developers request a model by its marketing name (e.g. 'gpt-4o') while the Trae menu shows a different display label; org policies hide certain models; Trae updated and renamed menu entries; or the menu failed to fully render so only a partial label list was captured.","solutions":["Run the command with `--list` (or no name) to see the exact available labels and re-run with a matching substring.","Use a shorter, unambiguous substring of the label shown in the detail's available=[...] array.","Verify the model actually exists in this Trae workspace/plan; request access or pick another model.","Update the tooling if Trae renamed model entries so docs/aliases match new labels."],"exampleFix":"// before\nawait cli('trae-solo', 'model', 'claude-3-5-sonnet');\n// after\nconst opts = await cli('trae-solo', 'model', { list: true });\nconst target = opts.find(m => /claude/i.test(m.Model));\nif (target) await cli('trae-solo', 'model', target.Model);","handlingStrategy":"validation","validationCode":"const listed = await cli('trae-solo', 'model', { list: true });\nif (!listed.some(m => m.Model.toLowerCase().includes(name))) {\n  throw new Error(`'${name}' not offered. Options: ${listed.map(m => m.Model).join(', ')}`);\n}","typeGuard":"const hasModel = (labels, name) =>\n  Array.isArray(labels) && labels.some(l => typeof l === 'string' && l.toLowerCase().includes(name.toLowerCase()));","tryCatchPattern":"try {\n  await cli('trae-solo', 'model', name);\n} catch (e) {\n  if (/No model matched/.test(e.message)) {\n    console.warn('Available:', e.detail); // detail carries available=[...]\n  } else throw e;\n}","preventionTips":["Always run --list first when unsure of exact model labels.","Match on short, distinctive substrings rather than full marketing names.","Keep an alias map from model names you use to labels Trae displays.","Re-check the available list after Trae updates."],"tags":["ui-automation","selector","trae","model-selection"],"backgroundTag":"model-option-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}