DIYgod/RSSHub · error · ConfigNotFoundError
缺少雪球用户登录后的 Cookie 值
Error message
缺少雪球用户登录后的 Cookie 值
What it means
ConfigNotFoundError thrown by the Xueqiu timeline handler when config.xueqiu.cookies is undefined. The home timeline API requires an authenticated xq_a_token cookie that RSSHub cannot obtain anonymously, so the route hard-fails at startup of the request rather than making doomed API calls. Message is in Chinese: '缺少雪球用户登录后的 Cookie 值' (missing Xueqiu logged-in cookie).
Source
Thrown at lib/routes/xueqiu/timeline.ts:44
},
name: '用户关注时间线',
maintainers: ['ErnestDong'],
handler,
description: `::: warning
用户关注动态需要登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
:::
| -1 | -2 | 1 |
| ---- | -------- | ------------- |
| 全部 | 关注精选 | 自定义第 1 组 |`,
};
async function handler(ctx) {
const cookie = config.xueqiu.cookies;
const limit = ctx.req.query('limit') || 15;
const usergroup_id = ctx.req.param('usergroup_id') ?? -1;
if (cookie === undefined) {
throw new ConfigNotFoundError('缺少雪球用户登录后的 Cookie 值');
}
let out: DataItem[] = [];
let max_id = -1;
async function fetchItems() {
const data = await fetchNextID(max_id, cookie as string, usergroup_id);
const items = await Promise.all(
data.home_timeline.map((item) =>
cache.tryGet(item.target, async () => {
const retweetedStatus = item.retweeted_status ? `<blockquote>${item.retweeted_status.user.screen_name}: ${item.retweeted_status.description}</blockquote>` : '';
const description = item.description + retweetedStatus;
const result = await Promise.resolve({
title: item.title === '' ? item.user.screen_name + (item.retweeted_status ? ' 转发' : '') : item.title,
description: item.text ? item.text + retweetedStatus : description,
pubDate: parseDate(item.created_at),
link: rootUrl + item.target,
});
return result;View on GitHub (pinned to bed535e087)
Solutions
- Set XUEQIU_COOKIES in the RSSHub environment to the full Cookie header string copied from a logged-in xueqiu.com browser session (it must include xq_a_token).
- Restart RSSHub after setting the env var so config reloads.
- If the cookie stops working later (Xueqiu sessions expire), refresh it from the browser and update the env var.
Example fix
// before
if (cookie === undefined) {
throw new ConfigNotFoundError('缺少雪球用户登录后的 Cookie 值');
}
// after — name the env var explicitly so the operator knows what to set
if (cookie === undefined) {
throw new ConfigNotFoundError('缺少雪球用户登录后的 Cookie 值 (set the XUEQIU_COOKIES environment variable with the Cookie header from a logged-in xueqiu.com session, including xq_a_token)');
} Defensive patterns
Strategy: validation
Validate before calling
import { config } from '@/config';
function requireXueqiuCookie() {
const cookie = config.xueqiu.cookies;
if (cookie === undefined) {
throw new ConfigNotFoundError('Set the XUEQIU_COOKIES env var to the Cookie header from a logged-in xueqiu.com session (must include xq_a_token).');
}
return cookie as string;
} Prevention
- Set XUEQIU_COOKIES at deploy time and restart RSSHub.
- Copy the entire Cookie header (not just one token) from a logged-in browser session.
- Refresh the cookie periodically — Xueqiu sessions expire.
- Treat this route as self-host-only; it cannot work on the public instance.
When it happens
Trigger: Any request to /xueqiu/timeline/:usergroup_id when the XUEQIU_COOKIES environment variable is not set on the RSSHub instance. The check `if (cookie === undefined)` fires immediately in the handler.
Common situations: Self-hosted RSSHub without XUEQIU_COOKIES configured; the route is documented as self-host-only because it needs personal cookies; deploy via Docker without passing the env var.
Related errors
- 缺少雪球用户登录后的 Cookie 值
- Error occurred, please refresh the page or try again after l
- 缺少 Medium 用户 ${user} 登录后的 Cookie 值
- 缺少 Medium 用户 ${user} 登录后的 Cookie 值
- 缺少 Medium 用户 ${user} 登录后的 Cookie 值
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/941f5dbd074c5321.
Report an issue: GitHub.