jackwener/OpenCLI · error · EmptyResultError

chatgpt detail

Error message

chatgpt detail

What it means

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.

Source

Thrown at clis/chatgpt/detail.js:59

            'Example: opencli chatgpt detail <id> --wait true --timeout 600',
        );
        const stableSeconds = requireNonNegativeInt(
            Number(kwargs.stable ?? 6),
            'chatgpt detail --stable',
            'Example: opencli chatgpt detail <id> --wait true --stable 6',
        );
        await page.goto(`${CHATGPT_URL}/c/${id}`, { settleMs: 2000 });
        try {
            await page.wait({ selector: CONVERSATION_MESSAGE_SELECTOR, timeout: 10 });
        } catch {
            // Empty conversation, missing access, or login redirect — handled by ensureChatGPTLogin / EmptyResultError below.
        }
        await ensureChatGPTLogin(page, 'ChatGPT detail requires a logged-in ChatGPT session.');
        const { messages, rows } = shouldWait
            ? await waitForChatGPTDetailRows(page, { wantMarkdown, timeoutSeconds: timeout, stableSeconds })
            : await getChatGPTDetailRows(page, { wantMarkdown });
        if (!messages.length) {
            throw new EmptyResultError('chatgpt detail', `No visible ChatGPT messages were found for conversation ${id}.`);
        }
        return rows;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the /c/<id> URL in a browser to confirm messages exist and render normally.
  2. Re-run with --wait (and a larger --timeout) so extraction waits for rows to stabilize.
  3. Re-login / refresh session cookies, then retry.
  4. If rows exist in the browser but extraction is empty, check for DOM changes and update the library.

Example fix

// before
opencli chatgpt detail 68a2...
// after
opencli chatgpt detail 68a2... --wait --timeout 60
Defensive patterns

Strategy: retry

Validate before calling

// Verify the conversation has content before extracting detail
const history = await run('chatgpt history', '--limit', '50');
if (!history.some(c => String(c.link || c).includes(id))) {
  throw new Error(`Conversation ${id} not found in sidebar history`);
}

Type guard

function hasMessages(extraction) {
  return !!extraction && Array.isArray(extraction.messages) && extraction.messages.length > 0;
}

Try / catch

try {
  const rows = await run('chatgpt detail', id, '--wait');
} catch (err) {
  if (String(err.message).includes('chatgpt detail')) {
    await sleep(10_000);
    return run('chatgpt detail', id, '--wait', '--timeout', '60');
  }
  throw err;
}

Prevention

When it happens

Trigger: `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).

Common situations: 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.

Related errors


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