jackwener/OpenCLI · error · AuthRequiredError
Xiaohongshu 点点 did not accept the query. Check login status
Error message
Xiaohongshu 点点 did not accept the query. Check login status for www.xiaohongshu.com.
What it means
This error is thrown by mapAskError when the Xiaohongshu ask command's in-page script reports error === 'send_message_failed', meaning the query could not be delivered to 点点 (Xiaohongshu's AI assistant) inside the logged-in browser page. The library maps this specific failure to AuthRequiredError because in practice the most common cause is an expired or missing login session on www.xiaohongshu.com. It tells the developer to re-authenticate before retrying.
Source
Thrown at clis/xiaohongshu/ask.js:369
};
}
})()
`;
}
function requirePrompt(query) {
const prompt = String(query || '').trim();
if (!prompt) throw new ArgumentError('query is required');
return prompt;
}
function mapAskError(raw, timeoutSeconds) {
const error = compactSingleLine(raw?.error);
if (error === 'answer_timeout') {
throw new TimeoutError('xiaohongshu ask', timeoutSeconds, '点点没有在超时时间内返回答案;可以重试或提高 --timeout。');
}
if (error === 'send_message_failed') {
throw new AuthRequiredError(XHS_WEB_HOST, 'Xiaohongshu 点点 did not accept the query. Check login status for www.xiaohongshu.com.');
}
throw new CommandExecutionError(
`xiaohongshu ask failed: ${error || 'unknown error'}`,
raw?.page_url ? `Page URL: ${raw.page_url}` : undefined,
);
}
function requireAskPayload(raw) {
if (!raw || typeof raw !== 'object') {
throw new CommandExecutionError('xiaohongshu ask returned a malformed page payload');
}
const answer = cleanText(raw.answer || raw.base_info?.text || '');
if (!answer) {
throw new CommandExecutionError('xiaohongshu ask returned a malformed page payload: missing answer');
}
if (!compactSingleLine(raw.message_id) || !compactSingleLine(raw.conversation_id)) {
throw new CommandExecutionError('xiaohongshu ask returned a malformed page payload: missing message identity');
}View on GitHub (pinned to 49907e53dc)
Solutions
- Run the xiaohongshu login flow (or the site auth command) to refresh the www.xiaohongshu.com session, then retry the ask command.
- Open www.xiaohongshu.com in the controlled browser and verify you can manually send a message to 点点.
- Retry with a longer --timeout in case the send timed out transiently.
- Capture raw.page_url / page state and check whether XHS redirected to a login or verification page.
- Update the library in case the XHS send-message DOM/API changed.
Example fix
// before await cli.run(['xiaohongshu','ask','--query','...']); // fails if session expired // after await cli.run(['xiaohongshu','login']); // refresh session first await cli.run(['xiaohongshu','ask','--query','...']);
Defensive patterns
Strategy: try-catch
Validate before calling
// before calling ask, ensure session exists if (!(await hasXhsSessionCookies(page))) await runXhsLogin();
Try / catch
try {
await xiaohongshuAsk({ query });
} catch (e) {
if (e instanceof AuthRequiredError || /login status/.test(e.message)) {
await runXhsLogin();
return xiaohongshuAsk({ query });
}
throw e;
} Prevention
- Refresh the XHS session (login) before long-running automation batches.
- Detect login-page redirects on www.xiaohongshu.com and re-auth proactively.
- Persist and reuse a validated browser profile so cookies survive restarts.
- Monitor AuthRequiredError occurrences as a signal to rotate/refresh sessions.
When it happens
Trigger: page.evaluate(buildAskEvaluateJs(...)) returns {ok:false, error:'send_message_failed'} — the page-side script failed to send the query to the 点点 chat, and mapAskError converts it to AuthRequiredError(XHS_WEB_HOST, ...).
Common situations: Session cookies for www.xiaohongshu.com expired or were cleared; the user is logged out; XHS flags the automated browser and rejects the message send; the conversation endpoint changed server-side so the send action fails.
Related errors
- Xiaohongshu creator profile requires login: ${detail}
- 请先在共享 Chrome 完成 1688 登录/验证,再重试(${action})
- Bilibili ${label} API requires login or permission: ${messag
- bilibili.com
- ${probe.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/794e989b2cf1df76.
Report an issue: GitHub.