DIYgod/RSSHub · error · ConfigNotFoundError
缺少雪球用户登录后的 Cookie 值
Error message
缺少雪球用户登录后的 Cookie 值
What it means
ConfigNotFoundError thrown by the Xueqiu user-stock handler when config.xueqiu.cookies is undefined. The portfolio/list.json endpoint requires an authenticated Cookie header (sent verbatim in the request), so the route refuses to proceed without it. Same Chinese message as the timeline route.
Source
Thrown at lib/routes/xueqiu/user-stock.ts:41
supportScihub: false,
},
radar: [
{
source: ['xueqiu.com/u/:id'],
},
],
name: '用户自选动态',
maintainers: ['hillerliao'],
handler,
description: `::: warning
用户自选动态需要登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
:::`,
};
async function handler(ctx) {
const cookie = config.xueqiu.cookies;
if (cookie === undefined) {
throw new ConfigNotFoundError('缺少雪球用户登录后的 Cookie 值');
}
const id = ctx.req.param('id');
const {
data: { stocks: data },
} = await ofetch(`https://stock.xueqiu.com/v5/stock/portfolio/stock/list.json?category=1&size=1000&uid=${id}`, {
headers: {
Cookie: cookie,
Referer: `https://xueqiu.com/u/${id}`,
},
});
const {
user: { screen_name },
} = await ofetch('https://xueqiu.com/statuses/original/show.json', {
query: {
user_id: id,View on GitHub (pinned to bed535e087)
Solutions
- Set XUEQIU_COOKIES to the Cookie header from a logged-in xueqiu.com session and restart RSSHub.
- Ensure the cookie includes the tokens Xueqiu's stock API validates (xq_a_token).
- Refresh periodically — Xueqiu login sessions expire.
Example fix
// before
if (cookie === undefined) {
throw new ConfigNotFoundError('缺少雪球用户登录后的 Cookie 值');
}
// after
if (cookie === undefined) {
throw new ConfigNotFoundError('缺少雪球用户登录后的 Cookie 值 (set XUEQIU_COOKIES env var to the Cookie header of a logged-in xueqiu.com session)');
} 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.');
}
return cookie as string;
} Prevention
- Configure XUEQIU_COOKIES before subscribing to any user-stock feed.
- Ensure the cookie includes xq_a_token, which the portfolio API validates.
- Refresh the cookie when Xueqiu sessions expire.
When it happens
Trigger: Any request to /xueqiu/user-stock/:id when XUEQIU_COOKIES is unset. The guard fires before the ofetch to stock.xueqiu.com/v5/stock/portfolio/stock/list.json, which would otherwise 400/401 without a valid cookie.
Common situations: Same as 647: self-hosted instance without XUEQIU_COOKIES; the route is self-host-only and documented as needing a login cookie; cookie expired and the operator removed it.
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/d913e8fe8f67b7c9.
Report an issue: GitHub.