{"record":{"id":"5c5118116a6de71d","repo":"DIYgod/RSSHub","slug":"rss","errorCode":null,"errorMessage":"该 RSS 源由于配置不正确而被禁用：令牌丢失。","messagePattern":"该 RSS 源由于配置不正确而被禁用：令牌丢失。","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/zsxq/group.ts","lineNumber":46,"sourceCode":"                name: 'ZSXQ_ACCESS_TOKEN',\n                description:\n                    '知识星球访问令牌,获取方式：\\n1. 登录知识星球网页版\\n2. 打开浏览器开发者工具，切换到 Application 面板\\n3. 点击侧边栏中的Storage -> Cookies -> https://wx.zsxq.com\\n4. 复制 Cookie 中的 zsxq_access_token 值',\n            },\n        ],\n    },\n    handler,\n    description: `| all  | digests | by\\\\_owner | questions | tasks |\n| ---- | ------- | --------- | --------- | ----- |\n| 最新 | 精华    | 只看星主  | 问答      | 作业  |`,\n};\n\nasync function handler(ctx: Context): Promise<Data> {\n    const groupId = ctx.req.param('id');\n    const scope = ctx.req.param('scope') ?? 'all';\n    const accessToken = config.zsxq.accessToken;\n\n    if (!accessToken) {\n        throw new ConfigNotFoundError('该 RSS 源由于配置不正确而被禁用：令牌丢失。');\n    }\n\n    let count = Number(ctx.req.query('limit')) || 20;\n    if (count > 30) {\n        count = 30;\n    }\n\n    const { group } = await customFetch<GroupInfoResponse>(`/groups/${groupId}`);\n\n    const { topics } = await customFetch<TopicsResponse>(`/groups/${groupId}/topics?scope=${scope}&count=${count}`);\n\n    return {\n        title: `知识星球 - ${group.name}`,\n        description: group.description,\n        image: group.background_url,\n        link: `https://wx.zsxq.com/dweb2/index/group/${groupId}`,\n        item: generateTopicDataItem(topics),\n    };","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/zsxq/group.ts#L28-L64","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (env missing) -> request returns 'route disabled'\n// after: in your environment / .env\nZSXQ_ACCESS_TOKEN=8c1a...your_token_here\n// then restart RSSHub","handlingStrategy":"validation","validationCode":"// before mounting/calling the route, ensure the token exists\nimport { config } from '@/config';\nfunction zsxqEnabled(): boolean {\n  return Boolean(config.zsxq?.accessToken);\n}\nif (!zsxqEnabled()) {\n  // surface a clear setup message instead of hitting the route\n  console.warn('ZSXQ_ACCESS_TOKEN is not set — /zsxq/group is disabled.');\n}","typeGuard":"import ConfigNotFoundError from '@/errors/types/config-not-found';\nfunction isConfigNotFoundError(e: unknown): e is ConfigNotFoundError {\n  return e instanceof Error && (e as ConfigNotFoundError).name === 'ConfigNotFoundError';\n}","tryCatchPattern":"try {\n  await ctx.fetch(`/zsxq/group/${id}`);\n} catch (e) {\n  if (isConfigNotFoundError(e)) {\n    return new Response('zsxq route disabled: set ZSXQ_ACCESS_TOKEN', { status: 503 });\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["config","zsxq","authentication","environment","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}