jackwener/OpenCLI · error · EmptyResultError
No messages found in /chat/
Error message
No messages found in /chat/${id}. What it means
Thrown by the kimi detail CLI command when it navigates to a Kimi conversation (/chat/<id>) and the DOM reader `readKimiTurns` returns zero message elements. The library treats an empty conversation page as a failed detail fetch rather than returning an empty result set. It wraps this in EmptyResultError to distinguish 'page loaded but no messages' from navigation or selector failures.
Solutions
- Verify the conversation id/URL is valid by opening it in a browser and confirming messages render.
- Retry the command once — first-load hydration may not have finished before readKimiTurns ran.
- Send at least one message in the conversation before fetching detail.
- Update the library or patch readKimiTurns selectors if the Kimi UI markup changed.
Example fix
// before: immediately fetch detail after creating a chat
await cli('kimi', 'detail', { conv: id });
// after: ensure the chat has content first
await cli('kimi', 'send', { conv: id, text: 'hello' });
await page.wait(2);
await cli('kimi', 'detail', { conv: id }); Defensive patterns
Strategy: retry
Validate before calling
// before calling detail
const read = await cli('kimi', 'read', { conv });
if (read.length === 0) await page.wait(2); // let hydration finish Type guard
function hasTurns(t) { return Array.isArray(t) && t.length > 0; } Try / catch
try {
const detail = await cli('kimi', 'detail', { conv });
} catch (e) {
if (/No messages found/.test(e.message)) {
await page.wait(2);
return retry(() => cli('kimi', 'detail', { conv }), 2);
}
throw e;
} Prevention
- Only fetch detail for conversations known to contain messages.
- Send a first message before reading a new chat.
- Add a small delay after navigation to allow DOM hydration.
- Validate conv ids against conversations you created in this session.
When it happens
Trigger: Calling `kimi detail` with a conv id/URL whose page contains no elements matched by the turn-reading selectors — e.g. a deleted, empty, or not-yet-rendered conversation, or a conv id that redirected to a new-chat page.
Common situations: Passing a stale chat id after Kimi expires/renames conversations; hitting the page before hydration finishes on slow networks; a Kimi UI update changing the DOM classes used to detect turns.
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
- No assistant message visible.
- No chat turns found on current page.
- composer type failed
- Copy button not visible
- document.cookie is empty (likely all cookies are httpOnly).
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/57b02636e46bf5b4.
Report an issue: GitHub.
Appendix: source
Thrown at clis/kimi/chat.js:180
],
columns: CHAT_COLUMNS,
func: async (page, kwargs) => {
const id = parseChatId(kwargs.id);
if (!id) throw new ArgumentError('id', 'is required');
// Same trick as maybeNavigateConv: include chat_enter_method=history
// to actually trigger Kimi's messages fetch.
await page.goto(`${KIMI_URL}chat/${id}?chat_enter_method=history`);
for (let i = 0; i < 15; i++) {
const ok = await page.evaluate(`(() => {
const list = document.querySelector('.chat-content-list') || document.querySelector('.message-list');
return !!list && list.querySelectorAll('.chat-content-item, .segment').length > 0;
})()`);
if (ok) break;
await page.wait(1);
}
const turns = await readKimiTurns(page);
if (!turns.length) {
throw new EmptyResultError('kimi detail', `No messages found in /chat/${id}.`);
}
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) }));
},
});
// -------- read --------
cli({
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: [View on GitHub (pinned to 49907e53dc)