{"record":{"id":"ec0646f2a019a136","repo":"jackwener/OpenCLI","slug":"chatgpt-deep-research-result-did-not-stay-on-reque","errorCode":null,"errorMessage":"ChatGPT deep-research-result did not stay on requested conversation ${conversationId}.","messagePattern":"ChatGPT deep-research-result did not stay on requested conversation (.+?)\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/utils.js","lineNumber":1836,"sourceCode":"                text,\n                html,\n            };\n        });\n        const matched = iframes.find((frame) => frame.deepResearch) || null;\n        return {\n            url: window.location.href,\n            title: document.title,\n            iframes,\n            deepResearchIframe: matched,\n        };\n    })()`)), 'chatgpt deep research iframe state');\n\n    const generating = await isGenerating(page).catch(() => false);\n    const iframe = iframeState.deepResearchIframe;\n    const currentConversationId = conversationIdFromUrl(iframeState.url);\n    if (conversationId) {\n        if (!currentConversationId) {\n            throw new CommandExecutionError(\n                `ChatGPT deep-research-result did not stay on requested conversation ${conversationId}.`,\n            );\n        }\n        if (currentConversationId !== conversationId) {\n            throw new CommandExecutionError(\n                `ChatGPT deep-research-result conversation mismatch: expected ${conversationId}, current page is ${currentConversationId}.`,\n            );\n        }\n    }\n    let progressCandidate = null;\n    const diagnostics = {\n        iframeCount: Array.isArray(iframeState.iframes) ? iframeState.iframes.length : 0,\n        iframe: iframe ? {\n            index: iframe.index,\n            title: iframe.title,\n            src: iframe.src,\n            visible: iframe.visible,\n            width: iframe.width,","sourceCodeStart":1818,"sourceCodeEnd":1854,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/utils.js#L1818-L1854","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-check login state and re-authenticate before retrying (ensureChatGPTLogin)","Re-run the deep research request and keep the tab focused so no redirect occurs","Verify the conversation URL is well-formed and the conversation still exists","Log iframeState.url at failure to identify where navigation went"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const url = await currentChatGPTUrl(page);\nif (!conversationIdFromUrl(url)) throw new Error('not on a conversation URL before waiting for deep research');","typeGuard":"function hasConversationId(url) { return typeof url === 'string' && /\\/c\\/[0-9a-f-]{36}/.test(url); }","tryCatchPattern":"try {\n  await waitForChatGPTDeepResearchResult(page, { conversationId });\n} catch (e) {\n  if (String(e.message).includes('did not stay on requested conversation')) {\n    await ensureChatGPTLogin(page, CHATGPT_DOMAIN); // likely a login redirect\n    // retry the request\n  } else throw e;\n}","preventionTips":["Ensure the session is logged in before starting deep research","Do not navigate or run other automation on the tab during the wait","Log iframeState.url on failure to diagnose where navigation went"],"tags":["chatgpt","navigation","deep-research","url"],"backgroundTag":"unexpected-page-navigation","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}