{"record":{"id":"2575ca58f00d3dfc","repo":"jackwener/OpenCLI","slug":"model-click-did-not-verify-selected-model-chose","errorCode":null,"errorMessage":"Model click did not verify selected model \"${chosenLabel}\".","messagePattern":"Model click did not verify selected model \"(.+?)\"\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/trae-solo/model.js","lineNumber":123,"sourceCode":"          const r = target.getBoundingClientRect();\n          const init = { bubbles: true, cancelable: true, button: 0, buttons: 1,\n            clientX: Math.round(r.left + r.width / 2),\n            clientY: Math.round(r.top + r.height / 2) };\n          target.dispatchEvent(new PointerEvent('pointerdown', { ...init, pointerType: 'mouse' }));\n          target.dispatchEvent(new MouseEvent('mousedown', init));\n          target.dispatchEvent(new PointerEvent('pointerup', { ...init, pointerType: 'mouse' }));\n          target.dispatchEvent(new MouseEvent('mouseup', init));\n          target.dispatchEvent(new MouseEvent('click', init));\n          return true;\n        })(${idx})`);\n                if (!fallbackClicked) {\n                    throw new CommandExecutionError('Click on model option failed.', `model=${chosenLabel}`);\n                }\n            }\n            await page.wait(0.6);\n            const after = await readCurrentModel(page);\n            if (!after || !after.toLowerCase().includes(name)) {\n                throw new CommandExecutionError(\n                    `Model click did not verify selected model \"${chosenLabel}\".`,\n                    after ? `current=${after}` : 'model trigger was unreadable after click',\n                );\n            }\n            return [{ Status: 'switched', Model: after }];\n        }\n\n        // Just read the current.\n        return [{ Status: 'Active', Model: current }];\n    },\n});\n","sourceCodeStart":105,"sourceCodeEnd":135,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-solo/model.js#L105-L135","documentation":"After clicking the chosen model option, the command re-reads `.core-model-select-trigger` text and verifies it now contains the requested substring; if the trigger is unreadable or still shows a different model, it throws this CommandExecutionError. It is a post-condition check ensuring the click actually changed the selection rather than silently doing nothing.","triggerScenarios":"The synthetic/CDP click landed but React state did not update; the menu item click was swallowed (e.g. hover-only submenu in a different build); the trigger text failed to re-render within the 0.6s wait; the selected label doesn't contain the requested substring (e.g. matched via a wrapper label); or the trigger became unreadable after the click.","commonSituations":"Very slow Trae UI where 0.6s is insufficient for the label to update; models whose display name doesn't contain the searched substring; Trae builds where clicking a row opens a nested confirm; automation running while the window is backgrounded so React skips renders.","solutions":["Re-run the command; if it verifies on retry, the wait was simply too short.","Check the error detail (`current=...`) to see what model is actually active and confirm whether the switch truly failed.","Verify the requested name is a substring of the FULL trigger label after switching (match on a longer/exact substring).","Wait for in-flight AI tasks to complete before switching models.","If persistent across attempts, the Trae build likely changed the menu behavior — update selectors/verification logic."],"exampleFix":"// before\nawait cli('trae-solo', 'model', 'gpt'); // label 'GPT-4o (preview)' may lag\n// after\nawait new Promise(r => setTimeout(r, 1500)); // let UI settle\nconst cur = await cli('trae-solo', 'model'); // read-only check\nif (!/gpt/i.test(cur[0].Model)) await cli('trae-solo', 'model', 'gpt');","handlingStrategy":"try-catch","validationCode":"const cur = await cli('trae-solo', 'model');\nif (cur[0]?.Model?.toLowerCase().includes(name)) return; // already active","typeGuard":"const switchVerified = (result, name) =>\n  Array.isArray(result) && typeof result[0]?.Model === 'string' &&\n  result[0].Status === 'switched' && result[0].Model.toLowerCase().includes(name.toLowerCase());","tryCatchPattern":"try {\n  await cli('trae-solo', 'model', name);\n} catch (e) {\n  if (/did not verify selected model/.test(e.message)) {\n    const actual = (e.detail || '').replace('current=', '');\n    console.warn(`Switch unverified; trigger shows: ${actual || 'unreadable'}`);\n    // re-read and retry before giving up\n  } else throw e;\n}","preventionTips":["Allow extra settle time (1–2s) on slow machines before assuming failure.","Match on a substring guaranteed to appear in the final trigger label.","Check the error detail to see the actual current model before retrying.","Skip the switch entirely if the desired model is already active."],"tags":["ui-automation","verification","trae","model-selection"],"backgroundTag":"ui-action-verification-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}