{"record":{"id":"ba1952f4e2b48b45","repo":"jackwener/OpenCLI","slug":"could-not-click-the-chatgpt-target-label-model","errorCode":null,"errorMessage":"Could not click the ChatGPT ${target.label} model option.","messagePattern":"Could not click the ChatGPT (.+?) model option\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/utils.js","lineNumber":728,"sourceCode":"            if (!option && Number.isInteger(target.intelligenceOrder)) {\n                if (intelligenceOptions.length === 5) {\n                    option = intelligenceOptions[target.intelligenceOrder] || null;\n                }\n            }\n            if (!(option instanceof HTMLElement) || !isVisible(option)) return { found: false };\n            option.scrollIntoView({ block: 'center', inline: 'center' });\n            const rect = option.getBoundingClientRect();\n            return {\n                found: true,\n                x: Math.round(rect.left + rect.width / 2),\n                y: Math.round(rect.top + rect.height / 2),\n            };\n        })()`)), 'chatgpt model option click');\n        if (optionCenter.found) break;\n        await page.wait(0.5);\n    }\n    if (!optionCenter?.found) {\n        throw new CommandExecutionError(`Could not click the ChatGPT ${target.label} model option.`);\n    }\n    await page.nativeClick(Number(optionCenter.x), Number(optionCenter.y));\n\n    await page.wait(0.5);\n    const after = await getCurrentChatGPTModel(page);\n    if (after.model !== target.key) {\n        await page.nativeClick(Number(menuButton.x), Number(menuButton.y));\n        await page.wait(0.5);\n        const checked = requireObjectEvaluateResult(unwrapEvaluateResult(await page.evaluate(`(() => {\n            const isVisible = (el) => {\n                if (!(el instanceof HTMLElement)) return false;\n                const style = window.getComputedStyle(el);\n                if (style.display === 'none' || style.visibility === 'hidden') return false;\n                const rect = el.getBoundingClientRect();\n                return rect.width > 0 && rect.height > 0;\n            };\n            const target = ${JSON.stringify(target)};\n            const intelligenceContent = document.querySelector('[data-testid=\"composer-intelligence-picker-content\"]');","sourceCodeStart":710,"sourceCodeEnd":746,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/utils.js#L710-L746","documentation":"The model menu is open and the library polls (up to 10 attempts, 0.5s apart) for the target model option item by label/testid/geometry. If the option never becomes clickable it throws CommandExecutionError naming the target label. This prevents clicking at null/zero coordinates.","triggerScenarios":"The menu opened but the desired option is not in it: the account doesn't have access to that tier (e.g. Pro hidden on free plans), the option's label/testid changed in a ChatGPT rollout, the menu rendered in a different locale so labels don't match, or the menu closed between click and scan.","commonSituations":"Requesting 'gpt-5.6-pro' or 'pro' on an account without that entitlement; ChatGPT renaming options (e.g. 'Thinking' -> 'Advanced') before the library catches up; localized UIs where optionLabels don't include the user's language; very slow rendering exhausting the 10 x 0.5s retry window.","solutions":["Verify the option actually appears in your ChatGPT model menu for this account; pick a tier you have access to.","Wait/retry — if rendering is just slow, a rerun often succeeds.","Set OPENCLI_CHATGPT_MODEL_DEBUG=1 and inspect what options the menu actually contained.","Update the library so option labels/testids match the current ChatGPT DOM, or align the UI language to one in the labels list (English/Chinese)."],"exampleFix":"// before\nawait selectChatGPTModel(page, 'pro'); // option missing on free plan\n// after\nawait selectChatGPTModel(page, 'advanced'); // tier available to the account","handlingStrategy":"retry","validationCode":"await ensureChatGPTComposer(page);\nawait getCurrentChatGPTModel(page); // confirm session & menu render before opening the picker","typeGuard":"function optionFound(res) {\n  return res != null && res.found === true && Number.isFinite(Number(res.x));\n}","tryCatchPattern":"try {\n  await selectChatGPTModel(page, model);\n} catch (err) {\n  if (err instanceof CommandExecutionError && /Could not click the ChatGPT/.test(err.message)) {\n    await page.wait(1);\n    return selectChatGPTModel(page, model); // one retry for slow menu render\n  }\n  throw err;\n}","preventionTips":["Select only tiers visible in the account's model menu (entitlement check).","Prefer tiers with known testIds (fast, advanced, gpt-5.6-pro, pro) over label-only matches.","Retry once for slow menu rendering before failing.","Keep the browser locale to a language in the option labels list."],"tags":["browser-automation","dom-selector","chatgpt","entitlement"],"backgroundTag":"dom-element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}