DIYgod/RSSHub · error · ConfigNotFoundError

该 RSS 源由于配置不正确而被禁用:令牌丢失。

Error message

该 RSS 源由于配置不正确而被禁用:令牌丢失。

What it means

Same ConfigNotFoundError pattern as the group route, but in lib/routes/zsxq/user.ts. The handler guards config.zsxq.accessToken before fetching /users/:id and throws when it is absent. RSSHub treats ConfigNotFoundError specially so the feed reports a configuration problem rather than an internal error.

Source

Thrown at lib/routes/zsxq/user.ts:41

    ],
    features: {
        requireConfig: [
            {
                name: 'ZSXQ_ACCESS_TOKEN',
                description:
                    '知识星球访问令牌,获取方式:\n1. 登录知识星球网页版\n2. 打开浏览器开发者工具,切换到 Application 面板\n3. 点击侧边栏中的Storage -> Cookies -> https://wx.zsxq.com\n4. 复制 Cookie 中的 zsxq_access_token 值',
            },
        ],
    },
    handler,
};

async function handler(ctx: Context): Promise<Data> {
    const uid = ctx.req.param('id');
    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 userInfo = await customFetch<UserInfoResponse>(`/users/${uid}`);

    const { topics } = await customFetch<TopicsResponse>(`/users/${uid}/topics/footprint?count=${count}`);

    return {
        title: `知识星球 - ${userInfo.user.name}`,
        description: userInfo.user.introduction,
        image: userInfo.user.avatar_url,
        link: `https://wx.zsxq.com/dweb2/index/footprint/${uid}`,
        item: generateTopicDataItem(topics),
    };

View on GitHub (pinned to bed535e087)

Solutions

  1. Set ZSXQ_ACCESS_TOKEN exactly (note the full name) from the wx.zsxq.com cookie.
  2. Restart RSSHub after setting it.
  3. Confirm both /zsxq/group and /zsxq/user read the same env var — fixing it fixes both.
  4. If using a secrets manager, ensure the var is injected into the RSSHub process env.

Example fix

// before: /zsxq/user/2414218251 -> 'route disabled'
// after: export ZSXQ_ACCESS_TOKEN=<token-from-cookie> && restart
Defensive patterns

Strategy: validation

Validate before calling

import { config } from '@/config';
if (!config.zsxq?.accessToken) {
  // do not expose /zsxq/user — warn operator at boot
  console.warn('ZSXQ_ACCESS_TOKEN missing — /zsxq/user 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 fetchZsxqUser(uid);
} catch (e) {
  if (isConfigNotFoundError(e)) return respondDisabled('Set ZSXQ_ACCESS_TOKEN');
  throw e;
}

Prevention

When it happens

Trigger: Requesting /zsxq/user/:id (user footprint/feed) while ZSXQ_ACCESS_TOKEN is unset or empty. The guard at user.ts:40 fires before the /users/${uid} call.

Common situations: Operator forgot to set the token for the user route even if other zsxq routes work; env var typo (e.g. ZSXQ_TOKEN instead of ZSXQ_ACCESS_TOKEN); token rotated and not updated.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/c2e008840637a88a. Report an issue: GitHub.