jackwener/OpenCLI · error · CommandExecutionError

ChatGPT deep-research-result did not stay on requested conve

Error message

ChatGPT deep-research-result did not stay on requested conversation ${conversationId}.

What it means

After waiting for a Deep Research run, the library checks the URL of the deep-research iframe/page. If a target conversationId was requested but the current URL yields no conversation id at all, the run is assumed to have navigated somewhere unidentifiable and the library throws rather than extracting from the wrong conversation.

Source

Thrown at clis/chatgpt/utils.js:1836

                text,
                html,
            };
        });
        const matched = iframes.find((frame) => frame.deepResearch) || null;
        return {
            url: window.location.href,
            title: document.title,
            iframes,
            deepResearchIframe: matched,
        };
    })()`)), 'chatgpt deep research iframe state');

    const generating = await isGenerating(page).catch(() => false);
    const iframe = iframeState.deepResearchIframe;
    const currentConversationId = conversationIdFromUrl(iframeState.url);
    if (conversationId) {
        if (!currentConversationId) {
            throw new CommandExecutionError(
                `ChatGPT deep-research-result did not stay on requested conversation ${conversationId}.`,
            );
        }
        if (currentConversationId !== conversationId) {
            throw new CommandExecutionError(
                `ChatGPT deep-research-result conversation mismatch: expected ${conversationId}, current page is ${currentConversationId}.`,
            );
        }
    }
    let progressCandidate = null;
    const diagnostics = {
        iframeCount: Array.isArray(iframeState.iframes) ? iframeState.iframes.length : 0,
        iframe: iframe ? {
            index: iframe.index,
            title: iframe.title,
            src: iframe.src,
            visible: iframe.visible,
            width: iframe.width,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-check login state and re-authenticate before retrying (ensureChatGPTLogin)
  2. Re-run the deep research request and keep the tab focused so no redirect occurs
  3. Verify the conversation URL is well-formed and the conversation still exists
  4. Log iframeState.url at failure to identify where navigation went
Defensive patterns

Strategy: try-catch

Validate before calling

const url = await currentChatGPTUrl(page);
if (!conversationIdFromUrl(url)) throw new Error('not on a conversation URL before waiting for deep research');

Type guard

function hasConversationId(url) { return typeof url === 'string' && /\/c\/[0-9a-f-]{36}/.test(url); }

Try / catch

try {
  await waitForChatGPTDeepResearchResult(page, { conversationId });
} catch (e) {
  if (String(e.message).includes('did not stay on requested conversation')) {
    await ensureChatGPTLogin(page, CHATGPT_DOMAIN); // likely a login redirect
    // retry the request
  } else throw e;
}

Prevention

When it happens

Trigger: conversationId is provided, currentChatGPTUrl/conversationIdFromUrl returns empty (URL is not a conversation URL) while waiting for deep-research-result — e.g. iframe navigated to the home page, a login redirect, or an interstitial.

Common situations: Session expired mid-run causing redirect to login; ChatGPT showed an error/upgrade interstitial; deep-research iframe surfaced a non-conversation URL; script ran while the tab was redirected by another automation step.

Related errors


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