jackwener/OpenCLI · error · EmptyResultError

No chat turns found on current page.

Error message

No chat turns found on current page.

What it means

Thrown by the kimi read command when `readKimiTurns(page)` finds no chat turns on the currently open page. Unlike detail, this reads whatever conversation is currently loaded (optionally navigating via kwargs.conv). EmptyResultError signals the page has no readable message DOM nodes.

Source

Thrown at clis/kimi/chat.js:207

    site: 'kimi',
    name: 'read',
    access: 'read',
    description: 'Read messages in the current Kimi chat. Pass --conv <id> to navigate to a specific chat first.',
    domain: KIMI_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [
        { name: 'conv', required: false, help: 'Chat id or URL (navigates there before reading)' },
        { name: 'limit', type: 'int', required: false, default: 20 },
    ],
    columns: CHAT_COLUMNS,
    func: async (page, kwargs) => {
        await maybeNavigateConv(page, kwargs?.conv);
        const turns = await readKimiTurns(page);
        if (!turns.length) {
            throw new EmptyResultError('kimi read', 'No chat turns found on current page.');
        }
        const limit = Number.isInteger(kwargs?.limit) && kwargs.limit > 0 ? kwargs.limit : 20;
        return turns.slice(0, limit).map((t, i) => ({ Index: i + 1, Role: t.role, Text: (t.text || '').slice(0, 1200) }));
    },
});

// Helper for read / detail: extract turns from the current chat content list.
// Kimi renders messages in `.chat-content-list` as `.chat-content-item`
// children — each gets a `chat-content-item-user` or `chat-content-item-assistant`
// modifier class (also mirrored on the inner `.segment-user` / `.segment-assistant`).
async function readKimiTurns(page) {
    return await page.evaluate(`(() => {
    ${IS_VISIBLE_JS}
    // Prefer .chat-content-list (the actual messages container); fall back
    // to .message-list (older Kimi UI) and .chat-detail-content (parent).
    const box = document.querySelector('.chat-content-list') || document.querySelector('.message-list') || document.querySelector('.chat-detail-content');
    if (!box) return [];
    // Find every chat-content-item or segment row.

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Send or receive at least one message in the conversation before running read.
  2. Pass the correct `conv` id/URL explicitly so the command navigates to a real conversation.
  3. Retry after a short wait to let the page finish rendering.
  4. Check for Kimi UI updates that may invalidate readKimiTurns selectors.

Example fix

// before
const turns = await cli('kimi', 'read');
// after
await cli('kimi', 'send', { text: 'hi' });
const turns = await cli('kimi', 'read', { conv: 'https://kimi.moonshot.cn/chat/<id>' });
Defensive patterns

Strategy: retry

Validate before calling

// ensure conversation has content before read
const convKnown = typeof kwargs.conv === 'string' && /chat\//.test(kwargs.conv);
if (!convKnown) await cli('kimi', 'send', { text: 'ping' });

Type guard

function hasTurns(t) { return Array.isArray(t) && t.length > 0; }

Try / catch

try {
  return await cli('kimi', 'read', { conv });
} catch (e) {
  if (/No chat turns found/.test(e.message)) {
    await page.wait(3);
    return cli('kimi', 'read', { conv });
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `kimi read` while the page shows a blank new-chat state, an unloaded/redirected conversation, or when kwargs.conv points to a nonexistent conversation.

Common situations: Calling read before sending any message in a fresh session; wrong conv id causing fallback to the new-chat screen; Kimi DOM changes breaking turn detection; slow page load racing the read.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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