jackwener/OpenCLI · error · CommandExecutionError

Could not click the ChatGPT ${target.label} model option.

Error message

Could not click the ChatGPT ${target.label} model option.

What it means

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.

Source

Thrown at clis/chatgpt/utils.js:728

            if (!option && Number.isInteger(target.intelligenceOrder)) {
                if (intelligenceOptions.length === 5) {
                    option = intelligenceOptions[target.intelligenceOrder] || null;
                }
            }
            if (!(option instanceof HTMLElement) || !isVisible(option)) return { found: false };
            option.scrollIntoView({ block: 'center', inline: 'center' });
            const rect = option.getBoundingClientRect();
            return {
                found: true,
                x: Math.round(rect.left + rect.width / 2),
                y: Math.round(rect.top + rect.height / 2),
            };
        })()`)), 'chatgpt model option click');
        if (optionCenter.found) break;
        await page.wait(0.5);
    }
    if (!optionCenter?.found) {
        throw new CommandExecutionError(`Could not click the ChatGPT ${target.label} model option.`);
    }
    await page.nativeClick(Number(optionCenter.x), Number(optionCenter.y));

    await page.wait(0.5);
    const after = await getCurrentChatGPTModel(page);
    if (after.model !== target.key) {
        await page.nativeClick(Number(menuButton.x), Number(menuButton.y));
        await page.wait(0.5);
        const checked = requireObjectEvaluateResult(unwrapEvaluateResult(await page.evaluate(`(() => {
            const isVisible = (el) => {
                if (!(el instanceof HTMLElement)) return false;
                const style = window.getComputedStyle(el);
                if (style.display === 'none' || style.visibility === 'hidden') return false;
                const rect = el.getBoundingClientRect();
                return rect.width > 0 && rect.height > 0;
            };
            const target = ${JSON.stringify(target)};
            const intelligenceContent = document.querySelector('[data-testid="composer-intelligence-picker-content"]');

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the option actually appears in your ChatGPT model menu for this account; pick a tier you have access to.
  2. Wait/retry — if rendering is just slow, a rerun often succeeds.
  3. Set OPENCLI_CHATGPT_MODEL_DEBUG=1 and inspect what options the menu actually contained.
  4. 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).

Example fix

// before
await selectChatGPTModel(page, 'pro'); // option missing on free plan
// after
await selectChatGPTModel(page, 'advanced'); // tier available to the account
Defensive patterns

Strategy: retry

Validate before calling

await ensureChatGPTComposer(page);
await getCurrentChatGPTModel(page); // confirm session & menu render before opening the picker

Type guard

function optionFound(res) {
  return res != null && res.found === true && Number.isFinite(Number(res.x));
}

Try / catch

try {
  await selectChatGPTModel(page, model);
} catch (err) {
  if (err instanceof CommandExecutionError && /Could not click the ChatGPT/.test(err.message)) {
    await page.wait(1);
    return selectChatGPTModel(page, model); // one retry for slow menu render
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/ba1952f4e2b48b45. Report an issue: GitHub.