jackwener/OpenCLI · error · Error
${data.error}. Are you logged into creator.xiaohongshu.com?
Error message
${data.error}. Are you logged into creator.xiaohongshu.com? What it means
The creator-stats in-page script catches its own exception and returns `{ error: e.message }`; the CLI rethrows it with a hint asking whether you are logged into creator.xiaohongshu.com. The underlying page-side message is preserved as the prefix. This exists because most failures of this script are authentication or permission failures on the creator dashboard.
Source
Thrown at clis/xiaohongshu/creator-stats.js:49
func: async (page, kwargs) => {
const period = kwargs.period || 'seven';
// Navigate to creator center for cookie context
await page.goto('https://creator.xiaohongshu.com/new/home');
const data = await page.evaluate(`
async () => {
try {
const resp = await fetch('/api/galaxy/creator/data/note_detail_new', {
credentials: 'include',
});
if (!resp.ok) return { error: 'HTTP ' + resp.status };
return await resp.json();
} catch (e) {
return { error: e.message };
}
}
`);
if (data?.error) {
throw new Error(data.error + '. Are you logged into creator.xiaohongshu.com?');
}
if (!data?.data) {
throw new Error('Unexpected response structure');
}
const stats = data.data[period];
if (!stats) {
throw new EmptyResultError('xiaohongshu creator-stats', `No data for period "${period}". Available: ${Object.keys(data.data).join(', ')}`);
}
// Format daily trend as sparkline-like summary
const formatTrend = (list) => {
if (!list || !list.length)
return '-';
return list.map((d) => d.count).join(' → ');
};
return [
{ metric: '观看数 (views)', total: stats.view_count ?? 0, trend: formatTrend(stats.view_list) },
{ metric: '平均观看时长 (avg view time ms)', total: stats.view_time_avg ?? 0, trend: formatTrend(stats.view_time_list) },
{ metric: '主页访问 (home views)', total: stats.home_view_count ?? 0, trend: formatTrend(stats.home_view_list) },View on GitHub (pinned to 49907e53dc)
Solutions
- Open creator.xiaohongshu.com in the browser profile used by the CLI and re-login if the session expired
- Read the error prefix (the original page-side message) to identify the real in-page failure
- Verify the command targets creator.xiaohongshu.com and the correct account/note
- Clear stale cookies or refresh the auth profile and retry
Defensive patterns
Strategy: try-catch
Validate before calling
// before calling: confirm session is alive
const loggedIn = await page.evaluate(() => location.hostname === 'creator.xiaohongshu.com' && !document.querySelector('.login-btn'));
if (!loggedIn) throw new Error('Not logged into creator.xiaohongshu.com'); Try / catch
try {
const stats = await getCreatorStats({ period });
} catch (e) {
if (e.message.includes('Are you logged into creator.xiaohongshu.com')) {
// refresh login/session cookies, then retry once
} else { throw e; }
} Prevention
- Refresh the xiaohongshu session cookies regularly; sessions expire
- Read the error prefix — it contains the real in-page failure reason
- Confirm the correct hostname (creator.xiaohongshu.com) is targeted
When it happens
Trigger: Any exception inside the page.evaluate script that its try/catch converted to `{ error: e.message }` — e.g. a page-side fetch to the stats endpoint failed with an auth error, a required element was missing, or the request threw.
Common situations: Expired xiaohongshu session cookies in the automation profile; running against the wrong host/URL; the creator account lacks stats permissions; Xiaohongshu endpoints changed and the in-page script threw.
Related errors
- Sign in to grok.com in the browser, then retry.
- WeChat article editor did not load. The session may have exp
- Amazon review discussion requires an active signed-in Amazon
- Could not extract CSRF token from barchart.com. Make sure yo
- Bilibili creator-center login is required: ${message}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/af5813f4dd138999.
Report an issue: GitHub.