{"record":{"id":"102945665f2be4c6","repo":"jackwener/OpenCLI","slug":"chatgpt-deep-research-result-conversation-mismatch","errorCode":null,"errorMessage":"ChatGPT deep-research-result conversation mismatch: expected ${conversationId}, current page is ${currentConversationId}.","messagePattern":"ChatGPT deep-research-result conversation mismatch: expected (.+?), current page is (.+?)\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/utils.js","lineNumber":1841,"sourceCode":"        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,\n            height: iframe.height,\n            accessible: iframe.accessible,\n            accessError: iframe.accessError || '',\n        } : null,\n        methodsTried: ['main-document-iframe'],","sourceCodeStart":1823,"sourceCodeEnd":1859,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/utils.js#L1823-L1859","documentation":"After a Deep Research run the library compares the conversation id parsed from the current page/iframe URL with the conversationId that was requested. A mismatch means the page moved to a different conversation, so results could be attributed to the wrong thread; the library throws instead of extracting.","triggerScenarios":"During waitForDeepResearchResult with a known conversationId, conversationIdFromUrl(iframeState.url) returns a different id — e.g. ChatGPT started a brand-new conversation, the user/automation navigated to another thread, or a follow-up prompt spawned a new conversation id.","commonSituations":"Submitting a deep-research prompt in an existing conversation but ChatGPT forks a new conversation; parallel automation scripts sharing one browser tab; clicking an old link that navigates mid-wait.","solutions":["Use the conversation id ChatGPT actually created (read it from the URL after submission) instead of assuming the pre-request id","Ensure only one automation drives the tab during the wait","Retry the request in a fresh conversation and track the returned conversation id","If forks are expected, treat the new id as authoritative and re-extract from that conversation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const current = conversationIdFromUrl(await currentChatGPTUrl(page));\nif (current && current !== conversationId) console.warn('conversation forked or navigated:', current);","typeGuard":"function isSameConversation(currentId, expectedId) { return typeof currentId === 'string' && currentId === expectedId; }","tryCatchPattern":"try {\n  await waitForChatGPTDeepResearchResult(page, { conversationId });\n} catch (e) {\n  const m = String(e.message).match(/conversation mismatch: expected (\\S+), current page is (\\S+)/);\n  if (m) {\n    // adopt m[2] as the new authoritative conversation id and re-extract\n  } else throw e;\n}","preventionTips":["Use the conversation id ChatGPT actually created after submitting the prompt","Dedicate one tab per automation run to prevent cross-navigation","Treat forking as expected: track id changes instead of assuming a fixed id"],"tags":["chatgpt","navigation","deep-research","conversation-id"],"backgroundTag":"unexpected-page-navigation","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}