DIYgod/RSSHub · error · ConfigNotFoundError

未配置 Cookie 或 Authorization。请检查配置。

Error message

未配置 Cookie 或 Authorization。请检查配置。

What it means

ConfigNotFoundError thrown by the UESTC BBS (清水河畔) route when either config.uestc.bbsCookie or config.uestc.bbsAuthStr is falsy. The forum API requires both a session Cookie and an Authorization header (UESTC_BBS_AUTH_KEY) for its /star/api/v1/index endpoint; without both the request would 401, so RSSHub fails fast with a Chinese-language message pointing to the env var.

Source

Thrown at lib/routes/uestc/bbs.ts:54

        supportScihub: false,
    },
    description: `::: tip
仅支持自建,您需要设置以下配置才能正常使用:

- 河畔 cookie: \`UESTC_BBS_COOKIE\`
- Header 中的授权字段: \`UESTC_BBS_AUTH_KEY\`

:::`,
    radar: [
        {
            source: ['bbs.uestc.edu.cn/*'],
            target: '/bbs/newthread',
        },
    ],
    handler: async (ctx) => {
        const { bbsCookie, bbsAuthStr } = config.uestc;
        if (!bbsCookie || !bbsAuthStr) {
            throw new ConfigNotFoundError('未配置 Cookie 或 Authorization。请检查配置。');
        }
        const { types = 'newreply,newthread,digest,life,hotlist' } = ctx.req.param();
        const data = await ofetch(`https://bbs.uestc.edu.cn/star/api/v1/index?top_list=${types}`, {
            headers: {
                Cookie: bbsCookie,
                Referer: 'https://bbs.uestc.edu.cn/new',
                authorization: bbsAuthStr,
            },
        });
        const itemsRaw = Object.entries<Array<Record<string, any>>>(data.data.top_list).flatMap(([label, items]) => items.map((item) => ({ ...item, label }) as Record<string, any>));
        const items = await Promise.all(
            itemsRaw.map((item) =>
                cache.tryGet(`https://bbs.uestc.edu.cn/forum.php?mod=viewthread&tid=${item.thread_id}`, async () => {
                    const response = await ofetch(`https://bbs.uestc.edu.cn/forum.php?mod=viewthread&tid=${item.thread_id}`, {
                        headers: {
                            Cookie: bbsCookie,
                            Referer: 'https://bbs.uestc.edu.cn',
                            authorization: bbsAuthStr,

View on GitHub (pinned to bed535e087)

Solutions

  1. Log in to https://bbs.uestc.edu.cn, copy the Cookie header value into UESTC_BBS_COOKIE.
  2. Copy the Authorization header value into UESTC_BBS_AUTH_KEY.
  3. Restart RSSHub.
  4. Re-extract both values periodically, since forum sessions expire.

Example fix

// before: env unset
// after
// UESTC_BBS_COOKIE=<full cookie string from browser>
// UESTC_BBS_AUTH_KEY=<authorization header value>
Defensive patterns

Strategy: validation

Validate before calling

function uestcBbsConfigured(cfg: any): boolean {
  return Boolean(cfg?.uestc?.bbsCookie && cfg?.uestc?.bbsAuthStr);
}
if (!uestcBbsConfigured(config)) { /* do not expose /uestc/bbs */ }

Try / catch

try { await fetchRss('/uestc/bbs/newthread'); }
catch (e) {
  if (/未配置 Cookie 或 Authorization/.test(String(e))) { /* disable feed until creds are set */ }
  else throw e;
}

Prevention

When it happens

Trigger: Requesting /uestc/bbs/newthread (or other type variants) without having set the UESTC_BBS_COOKIE and UESTC_BBS_AUTH_KEY environment variables. The guard runs before any HTTP call.

Common situations: Admin deployed RSSHub without UESTC-specific env vars; cookie expired and was removed from config; auth key rotated by the forum; user discovered the route via the route list but the instance is not configured for it.

Related errors


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