jackwener/OpenCLI · error · CommandExecutionError
ChatGPT composer is not available on the current page.
Error message
ChatGPT composer is not available on the current page.
What it means
ensureChatGPTLogin confirmed the user is on ChatGPT but no composer input element was found on the page, so the library throws CommandExecutionError with this message. The composer (the contenteditable prompt textbox) is required for ask/new/send commands; without it the CLI cannot type the prompt. The library treats this as an automation precondition failure, not a code bug.
Source
Thrown at clis/chatgpt/utils.js:373
hasComposer,
isLoggedIn: hasComposer || !!userMenu || !hasLoginGate,
hasLoginGate,
};
})()`)), 'chatgpt page state');
}
export async function ensureChatGPTLogin(page, message = 'ChatGPT requires a logged-in browser session.') {
const state = await getPageState(page);
if (!state.isLoggedIn || state.hasLoginGate) {
throw new AuthRequiredError(CHATGPT_DOMAIN, message);
}
return state;
}
export async function ensureChatGPTComposer(page, message = 'ChatGPT composer is not available on the current page.') {
const state = await ensureChatGPTLogin(page, message);
if (!state.hasComposer) {
throw new CommandExecutionError(message);
}
return state;
}
function requireKnownChatGPTModel(model) {
const key = String(model ?? '').trim().toLowerCase();
const targetKey = CHATGPT_MODEL_ALIASES[key] || key;
const option = CHATGPT_MODEL_TARGETS[targetKey];
if (!option) {
throw new ArgumentError(
`Unknown ChatGPT model "${model}"`,
`Choose one of: ${CHATGPT_MODEL_CHOICES.join(', ')}`,
);
}
return { key: targetKey, alias: key !== targetKey ? key : null, ...option };
}
function requireKnownChatGPTTool(tool) {View on GitHub (pinned to 49907e53dc)
Solutions
- Run the command again after waiting — transient slow renders often produce this.
- Open https://chatgpt.com in the same browser profile and confirm the composer is actually visible while logged in.
- Dismiss any captcha/Cloudflare challenge or upgrade/paywall dialog blocking the composer.
- Check for a ChatGPT UI update or library update; update the opencli package so COMPOSER_SELECTORS match the current DOM.
- Set OPENCLI_CHATGPT_MODEL_DEBUG=1 to see which automation step is failing and inspect the page state.
Example fix
// before
await askCommand({ prompt: 'hi' }); // throws if composer missing
// after
try {
await askCommand({ prompt: 'hi' });
} catch (err) {
if (err.message.includes('composer is not available')) {
await page.goto('https://chatgpt.com');
await page.wait(2);
return askCommand({ prompt: 'hi' });
}
throw err;
} Defensive patterns
Strategy: try-catch
Validate before calling
const state = await chatgpt.getLoginState(page);
if (!state.loggedIn || !state.hasComposer) {
await page.goto('https://chatgpt.com');
await page.wait(2);
} Type guard
function hasComposer(state) {
return typeof state === 'object' && state !== null && state.hasComposer === true;
} Try / catch
try {
await askCommand({ prompt });
} catch (err) {
if (err instanceof CommandExecutionError && /composer is not available/.test(err.message)) {
await page.goto('https://chatgpt.com');
await page.wait(2);
return askCommand({ prompt }); // one retry
}
throw err;
} Prevention
- Reuse a logged-in browser profile with the composer visible before automating.
- Add a short settle wait after navigation so the SPA renders the composer.
- Pin/track library updates for ChatGPT DOM selector changes.
- Handle captcha/Cloudflare screens out-of-band before running commands.
When it happens
Trigger: Calling askCommand, newCommand, or sendCommand (or selectChatGPTModel/selectChatGPTTool, which call ensureChatGPTComposer with a custom message) when the rendered ChatGPT page has no element matching COMPOSER_SELECTORS — e.g. a mid-flow captcha, a UI variant without the prompt-textarea, a paywall/upgrade interstitial, or the page failing to finish loading before the composer check.
Common situations: ChatGPT rolls out a DOM change that renames the composer testid/aria-label; headless browser stuck on a Cloudflare/captcha screen; logged in but landing on a page that redirects away from the composer; slow network so the SPA hasn't rendered the composer when checked; user logged into a workspace showing an admin/SSO interstitial.
Related errors
- Could not find the ChatGPT model selector in the composer.
- Could not find the ChatGPT tools menu button in the composer
- Could not click the ChatGPT ${target.label} model option.
- SignOut svg not found
- upgrade click failed
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/3910f1ef4567b28d.
Report an issue: GitHub.