{"record":{"id":"4c1e03e636ed3a25","repo":"jackwener/OpenCLI","slug":"no-assistant-message-visible","errorCode":null,"errorMessage":"No assistant message visible.","messagePattern":"No assistant message visible\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/kimi/chat.js","lineNumber":341,"sourceCode":"    name: 'copy-message',\n    access: 'write',\n    description: 'Return the text of the last assistant message. Pass --conv <id> to navigate to a specific chat first.',\n    domain: KIMI_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    siteSession: 'persistent',\n    navigateBefore: false,\n    args: [\n        { name: 'conv', required: false, help: 'Chat id or URL (navigates there before reading)' },\n        { name: 'click-button', type: 'boolean', default: false, help: 'Also click in-UI Copy button (writes to clipboard)' },\n    ],\n    columns: CHAT_COLUMNS,\n    func: async (page, kwargs) => {\n        await maybeNavigateConv(page, kwargs?.conv);\n        const turns = await readKimiTurns(page);\n        const assistantTurns = turns.filter((t) => t.role === 'Assistant');\n        if (!assistantTurns.length) {\n            throw new EmptyResultError('kimi copy-message', 'No assistant message visible.');\n        }\n        const last = assistantTurns[assistantTurns.length - 1];\n        if (kwargs?.['click-button'] === true || kwargs?.['click-button'] === 'true') {\n            const clickRes = await page.evaluate(clickBySvgNameScript('Copy'));\n            if (!clickRes?.ok) throw new CommandExecutionError(clickRes?.reason || 'Copy button not visible', '');\n        }\n        return [\n            { Field: 'Length', Value: String((last.text || '').length) + ' chars' },\n            { Field: 'ClipboardClicked', Value: (kwargs?.['click-button'] === true || kwargs?.['click-button'] === 'true') ? 'yes' : 'no' },\n            { Field: 'Text', Value: last.text || '' },\n        ];\n    },\n});\n\n// -------- regenerate --------\ncli({\n    site: 'kimi',\n    name: 'regenerate',","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/kimi/chat.js#L323-L359","documentation":"Thrown by kimi copy-message when the loaded page has no turns with role 'Assistant'. The command filters readKimiTurns output for assistant messages and errors out with EmptyResultError if none exist, since there is nothing to copy.","triggerScenarios":"Running copy-message on a conversation where Kimi has not yet replied — user-only conversation, assistant still streaming its first response, or an empty/new-chat page.","commonSituations":"Calling copy-message immediately after send before the reply arrives; reading the wrong conversation; a page where previous replies were deleted.","solutions":["Wait for the assistant response to finish (poll kimi read until an Assistant turn appears), then call copy-message.","Pass the correct `conv` id for a conversation that has replies.","Retry after a short wait if the response is still streaming."],"exampleFix":"// before\nawait cli('kimi', 'send', { text: 'hi' });\nawait cli('kimi', 'copy-message'); // may race the reply\n// after\nawait cli('kimi', 'send', { text: 'hi' });\nawait page.wait(5); // or poll kimi read for an Assistant turn\nawait cli('kimi', 'copy-message');","handlingStrategy":"retry","validationCode":"// only copy after an assistant turn exists\nconst turns = await cli('kimi', 'read', { conv });\nconst hasAssistant = turns.some(t => t.Role === 'Assistant');\nif (!hasAssistant) await page.wait(5);","typeGuard":"function hasAssistantTurn(t) { return Array.isArray(t) && t.some(x => x.Role === 'Assistant'); }","tryCatchPattern":"try {\n  return await cli('kimi', 'copy-message', { conv });\n} catch (e) {\n  if (/No assistant message visible/.test(e.message)) {\n    await page.wait(5);\n    return cli('kimi', 'copy-message', { conv });\n  }\n  throw e;\n}","preventionTips":["Wait for the reply to finish streaming before copying.","Poll kimi read for an Assistant turn as a readiness gate.","Point copy-message at the conversation that actually has replies."],"tags":["empty-result","dom-scraping","kimi"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}