DIYgod/RSSHub · error · ConfigNotFoundError
该 RSS 源由于配置不正确而被禁用:令牌丢失。
Error message
该 RSS 源由于配置不正确而被禁用:令牌丢失。
What it means
RSSHub throws ConfigNotFoundError to signal that a route is intentionally disabled because required configuration is missing — it is not a crash. In lib/routes/zsxq/group.ts the handler reads config.zsxq.accessToken (sourced from the ZSXQ_ACCESS_TOKEN env var) and, if it is falsy, throws this error. The dedicated error class lets RSSHub middleware return a controlled 'route disabled' response instead of a 500.
Source
Thrown at lib/routes/zsxq/group.ts:46
name: 'ZSXQ_ACCESS_TOKEN',
description:
'知识星球访问令牌,获取方式:\n1. 登录知识星球网页版\n2. 打开浏览器开发者工具,切换到 Application 面板\n3. 点击侧边栏中的Storage -> Cookies -> https://wx.zsxq.com\n4. 复制 Cookie 中的 zsxq_access_token 值',
},
],
},
handler,
description: `| all | digests | by\\_owner | questions | tasks |
| ---- | ------- | --------- | --------- | ----- |
| 最新 | 精华 | 只看星主 | 问答 | 作业 |`,
};
async function handler(ctx: Context): Promise<Data> {
const groupId = ctx.req.param('id');
const scope = ctx.req.param('scope') ?? 'all';
const accessToken = config.zsxq.accessToken;
if (!accessToken) {
throw new ConfigNotFoundError('该 RSS 源由于配置不正确而被禁用:令牌丢失。');
}
let count = Number(ctx.req.query('limit')) || 20;
if (count > 30) {
count = 30;
}
const { group } = await customFetch<GroupInfoResponse>(`/groups/${groupId}`);
const { topics } = await customFetch<TopicsResponse>(`/groups/${groupId}/topics?scope=${scope}&count=${count}`);
return {
title: `知识星球 - ${group.name}`,
description: group.description,
image: group.background_url,
link: `https://wx.zsxq.com/dweb2/index/group/${groupId}`,
item: generateTopicDataItem(topics),
};View on GitHub (pinned to bed535e087)
Solutions
- Set ZSXQ_ACCESS_TOKEN in the environment (extract zsxq_access_token from the wx.zsxq.com cookie via browser DevTools > Application > Cookies).
- Restart the RSSHub process so the new env var is picked up.
- For Docker, pass it with -e ZSXQ_ACCESS_TOKEN=<value>; for docker-compose add it under environment:.
- Verify it is loaded: the route's route config UI or echo $ZSXQ_ACCESS_TOKEN in the process shell.
Example fix
// before (env missing) -> request returns 'route disabled' // after: in your environment / .env ZSXQ_ACCESS_TOKEN=8c1a...your_token_here // then restart RSSHub
Defensive patterns
Strategy: validation
Validate before calling
// before mounting/calling the route, ensure the token exists
import { config } from '@/config';
function zsxqEnabled(): boolean {
return Boolean(config.zsxq?.accessToken);
}
if (!zsxqEnabled()) {
// surface a clear setup message instead of hitting the route
console.warn('ZSXQ_ACCESS_TOKEN is not set — /zsxq/group is disabled.');
} Type guard
import ConfigNotFoundError from '@/errors/types/config-not-found';
function isConfigNotFoundError(e: unknown): e is ConfigNotFoundError {
return e instanceof Error && (e as ConfigNotFoundError).name === 'ConfigNotFoundError';
} Try / catch
try {
await ctx.fetch(`/zsxq/group/${id}`);
} catch (e) {
if (isConfigNotFoundError(e)) {
return new Response('zsxq route disabled: set ZSXQ_ACCESS_TOKEN', { status: 503 });
}
throw e;
} Prevention
- Set ZSXQ_ACCESS_TOKEN in your deploy environment before enabling any zsxq route.
- Treat ConfigNotFoundError as a deployment signal, not a bug — it means config, not code, is missing.
- Add a startup check that warns on unset token-dependent routes.
When it happens
Trigger: Requesting /zsxq/group/:id (any scope: all, digests, by_owner, questions, tasks) when ZSXQ_ACCESS_TOKEN is unset or empty. The check at group.ts:45 fires before any network call.
Common situations: Fresh deploy without the env var set; .env not loaded in local dev; Docker/k8s pod missing the secret; token value accidentally cleared during config refactor; self-hosted instance where the operator skipped zsxq setup.
Related errors
- 该 RSS 源由于配置不正确而被禁用:令牌丢失。
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值
- 缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://do
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/5c5118116a6de71d.
Report an issue: GitHub.