DIYgod/RSSHub · error · ConfigNotFoundError

缺少 TSDM39 用户登录后的 Cookie 值 <a href="https://docs.rsshub.app/z

Error message

缺少 TSDM39 用户登录后的 Cookie 值 <a href="https://docs.rsshub.app/zh/deploy/config#route-specific-configurations">TSDM 相关路由</a>

What it means

ConfigNotFoundError thrown by the TSDM39 forum route because `config.tsdm39.cookie` is unset. The route needs an authenticated session cookie to access the forum display page, so without it the handler aborts before any request.

Source

Thrown at lib/routes/tsdm39/bd.ts:40

    const heading: string[] = [],
        separator: string[] = [],
        body: string[] = [];

    for (const key in mapping) {
        heading.push(mapping[key]);
        separator.push(':--:');
        body.push(key);
    }

    return [heading.join(' | '), separator.join(' | '), body.join(' | ')].map((s) => `| ${s} |`).join('\n');
};

const handler: Route['handler'] = async (ctx) => {
    const { type } = ctx.req.param();

    const cookie = config.tsdm39.cookie;
    if (!cookie) {
        throw new ConfigNotFoundError('缺少 TSDM39 用户登录后的 Cookie 值 <a href="https://docs.rsshub.app/zh/deploy/config#route-specific-configurations">TSDM 相关路由</a>');
    }

    const html = await ofetch(`https://www.tsdm39.com/forum.php?mod=forumdisplay&fid=85${type ? `&filter=typeid&typeid=${type}` : ''}`, {
        headers: {
            Cookie: cookie,
        },
    });

    const $ = load(html);

    const item = $('tbody.tsdm_normalthread')
        .toArray()
        .map<DataItem>((item) => {
            const $ = load(item);

            const title = $('a.xst').text();
            const price = $('span.xw1').last().text();
            const link = $('a.xst').attr('href');

View on GitHub (pinned to bed535e087)

Solutions

  1. Log in to https://www.tsdm39.com in a browser, copy the full Cookie header, and set it as `TSDM39_COOKIE` (or the documented env var) in your RSSHub config.
  2. Restart the RSSHub process so config is reloaded.
  3. If the cookie no longer works (forum changed), re-login and rotate it.
Defensive patterns

Strategy: validation

Validate before calling

if (!config.tsdm39?.cookie) { throw new ConfigNotFoundError('Set TSDM39_COOKIE before enabling this route'); }

Type guard

const hasCookie = (c: unknown): c is string => typeof c === 'string' && c.trim().length > 0;

Prevention

When it happens

Trigger: Deploying RSSHub without setting `TSDM39_COOKIE` (or the env var it maps from) — `config.tsdm39.cookie` is falsy on line 42 and line 43 throws. The message links to the route-specific config docs.

Common situations: Self-hosted RSSHub where the operator skipped TSDM-specific env vars; the cookie expired and the operator removed it; .env not loaded in the deployment.

Related errors


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