{"record":{"id":"53edbaccefd41774","repo":"jackwener/OpenCLI","slug":"no-claude-response-appeared-within-timeoutsecond","errorCode":null,"errorMessage":"No Claude response appeared within ${timeoutSeconds}s. Re-run with a higher --timeout if the model is still generating.","messagePattern":"No Claude response appeared within (.+?)s\\. Re-run with a higher --timeout if the model is still generating\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/claude/ask.js","lineNumber":122,"sourceCode":"        // Post-toggle settle dropped — the next CDP eval (sendMessage / sendWithFile)\n        // gives React enough time to flush aria-checked updates.\n\n        if (kwargs.file) {\n            const baseline = await withRetry(() => getBubbleCount(page));\n            try {\n                const fileResult = await sendWithFile(page, kwargs.file, prompt);\n                if (fileResult && !fileResult.ok) {\n                    throw new CommandExecutionError(fileResult.reason || 'Failed to attach file');\n                }\n            } catch (err) {\n                // SPA navigates after send; \"Promise was collected\" means send succeeded\n                if (!String(err?.message || err).includes('Promise was collected')) throw err;\n            }\n            // Pre-waitForResponse settle dropped — waitForResponse's first 3 s polling\n            // tick covers the same window without an unconditional sleep.\n            const result = await waitForResponse(page, baseline, prompt, timeoutMs);\n            if (!result) {\n                throw new EmptyResultError(\n                    'claude ask',\n                    `No Claude response appeared within ${timeoutSeconds}s. Re-run with a higher --timeout if the model is still generating.`,\n                );\n            }\n            return [{ response: result }];\n        }\n\n        const baseline = await withRetry(() => getBubbleCount(page));\n        const sendResult = await withRetry(() => sendMessage(page, prompt));\n        if (!sendResult?.ok) {\n            throw new CommandExecutionError(sendResult?.reason || 'Failed to send message');\n        }\n\n        const result = await waitForResponse(page, baseline, prompt, timeoutMs);\n        if (!result) {\n            throw new EmptyResultError(\n                'claude ask',\n                `No Claude response appeared within ${timeoutSeconds}s. Re-run with a higher --timeout if the model is still generating.`,","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/claude/ask.js#L104-L140","documentation":"After a file-backed send, waitForResponse() polled for a new Claude message bubble beyond the pre-send baseline and returned null at the timeout. The library throws EmptyResultError telling the user to raise --timeout if the model is still generating.","triggerScenarios":"`claude ask ... --file x` where no response appears within timeoutSeconds (default 120) — slow model generation, upload stuck, or the bubble-count never increased.","commonSituations":"Long generation on complex prompts with attached PDFs/images; very low --timeout value; upload failed silently so the message never sent.","solutions":["Re-run with a higher --timeout (e.g. --timeout 300).","Check the Claude tab manually to confirm the message actually sent.","Reduce the prompt/file size to shorten generation time."],"exampleFix":"// before\nopencli claude ask \"analyze this\" --file big.pdf --timeout 30\n// after\nopencli claude ask \"analyze this\" --file big.pdf --timeout 300","handlingStrategy":"retry","validationCode":"// Size the timeout to the workload: file analysis needs more time\nconst timeout = opts.file ? 300 : 120;\nif (opts.timeout && opts.timeout < (opts.file ? 180 : 60)) {\n  console.warn('timeout is low; consider raising --timeout');\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await opencli.claude.ask(prompt, { file, timeout: 120 });\n} catch (e) {\n  if (/No Claude response appeared within/.test(e.message)) {\n    return await opencli.claude.ask(prompt, { file, timeout: 600 });\n  }\n  throw e;\n}","preventionTips":["Use generous --timeout for file-heavy prompts.","Confirm the upload actually sent before waiting on the response.","Escalate timeout on retries rather than repeating the same value."],"tags":["timeout","empty-result","browser-automation"],"backgroundTag":"response-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}