{"record":{"id":"7cd90c6565427317","repo":"jackwener/OpenCLI","slug":"timeout","errorCode":null,"errorMessage":"点点没有在超时时间内返回答案；可以重试或提高 --timeout。","messagePattern":"点点没有在超时时间内返回答案；可以重试或提高 --timeout。","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"warning","filePath":"clis/xiaohongshu/ask.js","lineNumber":366,"sourceCode":"            error: String(err?.message || err || 'unknown_error'),\n            stack: String(err?.stack || '').slice(0, 1500),\n            page_url: location.href,\n          };\n        }\n      })()\n    `;\n}\n\nfunction requirePrompt(query) {\n    const prompt = String(query || '').trim();\n    if (!prompt) throw new ArgumentError('query is required');\n    return prompt;\n}\n\nfunction mapAskError(raw, timeoutSeconds) {\n    const error = compactSingleLine(raw?.error);\n    if (error === 'answer_timeout') {\n        throw new TimeoutError('xiaohongshu ask', timeoutSeconds, '点点没有在超时时间内返回答案；可以重试或提高 --timeout。');\n    }\n    if (error === 'send_message_failed') {\n        throw new AuthRequiredError(XHS_WEB_HOST, 'Xiaohongshu 点点 did not accept the query. Check login status for www.xiaohongshu.com.');\n    }\n    throw new CommandExecutionError(\n        `xiaohongshu ask failed: ${error || 'unknown error'}`,\n        raw?.page_url ? `Page URL: ${raw.page_url}` : undefined,\n    );\n}\n\nfunction requireAskPayload(raw) {\n    if (!raw || typeof raw !== 'object') {\n        throw new CommandExecutionError('xiaohongshu ask returned a malformed page payload');\n    }\n    const answer = cleanText(raw.answer || raw.base_info?.text || '');\n    if (!answer) {\n        throw new CommandExecutionError('xiaohongshu ask returned a malformed page payload: missing answer');\n    }","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/ask.js#L348-L384","documentation":"After sending a query to Xiaohongshu's 点点 assistant, the in-page script reports a raw error; mapAskError translates 'answer_timeout' into a TimeoutError noting that 点点 did not return an answer within the configured --timeout seconds. The message suggests retrying or raising --timeout. It is a mapped, expected failure mode rather than a bug.","triggerScenarios":"The raw in-page result contains error === 'answer_timeout' — the assistant conversation never produced a final answer within timeoutSeconds (1–180, default 90).","commonSituations":"Very complex/slow queries where 点点 needs longer than the default 90s; degraded backend latency on xiaohongshu's side; heavy network latency; asking during peak hours.","solutions":["Retry the same query — the timeout is often transient","Increase --timeout up to 180: opencli xiaohongshu ask --timeout 180 \"...\"","Simplify or split the query into smaller questions 点点 can answer faster","Verify the xiaohongshu login session is healthy and the site is reachable, then retry"],"exampleFix":"// before\nopencli xiaohongshu ask --timeout 90 \"very complex multi-part question\"\n// after\nopencli xiaohongshu ask --timeout 180 \"very complex multi-part question\"","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"const { TimeoutError } = errors;\ntry {\n  return await xiaohongshuAsk({ query, timeout: 180 });\n} catch (e) {\n  if (e instanceof TimeoutError && /answer/.test(e.command || '')) {\n    await sleep(5000);\n    return xiaohongshuAsk({ query, timeout: 180 }); // one retry\n  }\n  throw e;\n}","preventionTips":["Set --timeout 180 up front for complex or multi-part questions","Split big questions into smaller ones 点点 answers within 90s","Check xiaohongshu service health/login before long batch ask runs","Implement one retry with backoff for answer_timeout specifically"],"tags":["timeout","ai-assistant","xiaohongshu"],"backgroundTag":"assistant-answer-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}