{"record":{"id":"8ac81060ba8cd60f","repo":"jackwener/OpenCLI","slug":"chatgpt-detail","errorCode":null,"errorMessage":"chatgpt detail","messagePattern":"chatgpt detail","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/detail.js","lineNumber":59,"sourceCode":"            'Example: opencli chatgpt detail <id> --wait true --timeout 600',\n        );\n        const stableSeconds = requireNonNegativeInt(\n            Number(kwargs.stable ?? 6),\n            'chatgpt detail --stable',\n            'Example: opencli chatgpt detail <id> --wait true --stable 6',\n        );\n        await page.goto(`${CHATGPT_URL}/c/${id}`, { settleMs: 2000 });\n        try {\n            await page.wait({ selector: CONVERSATION_MESSAGE_SELECTOR, timeout: 10 });\n        } catch {\n            // Empty conversation, missing access, or login redirect — handled by ensureChatGPTLogin / EmptyResultError below.\n        }\n        await ensureChatGPTLogin(page, 'ChatGPT detail requires a logged-in ChatGPT session.');\n        const { messages, rows } = shouldWait\n            ? await waitForChatGPTDetailRows(page, { wantMarkdown, timeoutSeconds: timeout, stableSeconds })\n            : await getChatGPTDetailRows(page, { wantMarkdown });\n        if (!messages.length) {\n            throw new EmptyResultError('chatgpt detail', `No visible ChatGPT messages were found for conversation ${id}.`);\n        }\n        return rows;\n    },\n});\n","sourceCodeStart":41,"sourceCodeEnd":64,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/detail.js#L41-L64","documentation":"The `chatgpt detail` command throws EmptyResultError('chatgpt detail') when waitForChatGPTDetailRows/getChatGPTDetailRows return an empty messages array, meaning no visible ChatGPT messages could be extracted for the given conversation. The library fails loudly instead of returning zero rows.","triggerScenarios":"`opencli chatgpt detail <id>` where the conversation page contains no extractable message rows — empty conversation, wrong conversation ID, DOM changes hiding rows, or extraction racing before messages render (when run without --wait).","commonSituations":"Passing a conversation ID that has no visible messages (e.g. an archived/brand-new conversation); extraction running before React hydration finishes; ChatGPT UI updates moving message containers; stale logged-out page showing a login wall instead of messages.","solutions":["Open the /c/<id> URL in a browser to confirm messages exist and render normally.","Re-run with --wait (and a larger --timeout) so extraction waits for rows to stabilize.","Re-login / refresh session cookies, then retry.","If rows exist in the browser but extraction is empty, check for DOM changes and update the library."],"exampleFix":"// before\nopencli chatgpt detail 68a2...\n// after\nopencli chatgpt detail 68a2... --wait --timeout 60","handlingStrategy":"retry","validationCode":"// Verify the conversation has content before extracting detail\nconst history = await run('chatgpt history', '--limit', '50');\nif (!history.some(c => String(c.link || c).includes(id))) {\n  throw new Error(`Conversation ${id} not found in sidebar history`);\n}","typeGuard":"function hasMessages(extraction) {\n  return !!extraction && Array.isArray(extraction.messages) && extraction.messages.length > 0;\n}","tryCatchPattern":"try {\n  const rows = await run('chatgpt detail', id, '--wait');\n} catch (err) {\n  if (String(err.message).includes('chatgpt detail')) {\n    await sleep(10_000);\n    return run('chatgpt detail', id, '--wait', '--timeout', '60');\n  }\n  throw err;\n}","preventionTips":["Pass --wait so extraction waits for React hydration","Confirm the conversation renders in a browser before scripting it","Re-authenticate the session when the page shows a login wall","Treat one retry as normal; escalate only if it fails repeatedly"],"tags":["chatgpt","empty-result","dom-extraction"],"backgroundTag":"empty-result-no-data","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}