DIYgod/RSSHub · error · ConfigNotFoundError

huitun RSS is disabled due to the lack of <a href="https://d

Error message

huitun RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>

What it means

Thrown by the Huitun (灰豚数据) Xiaohongshu route when the RSSHub instance configuration does not include `config.huitun.cookie`. The Huitun API requires an authenticated session cookie to search for anchors and fetch notes. RSSHub's `ConfigNotFoundError` maps to an HTTP 502 response indicating the route is not configured. The route's `features.requireConfig` declares the `HUITUN_COOKIE` environment variable as required.

Source

Thrown at lib/routes/huitun/xiaohongshu.ts:33

                name: 'HUITUN_COOKIE',
                description: '灰豚数据 cookie 值',
            },
        ],
        requirePuppeteer: false,
        antiCrawler: true,
        supportBT: false,
        supportPodcast: false,
        supportScihub: false,
    },
    description: '免费版账户每天查询次数为 10 次,若需增加查询次数请购买灰豚数据红薯版会员',
    name: '小红书笔记',
    maintainers: ['Skylwn'],
    handler,
};

async function handler(ctx) {
    if (!config.huitun || !config.huitun.cookie) {
        throw new ConfigNotFoundError('huitun RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>');
    }
    const cookie = config.huitun.cookie;
    const uid = ctx.req.param('user_id');
    const response_user = await got({
        method: 'get',
        url: 'https://xhsapi.huitun.com/anchor/search/v2?keyword=' + uid,
        headers: {
            Cookie: cookie,
        },
    });
    const user_data = JSON.parse(response_user.body);
    const anchorId = user_data.extData.list[0].anchorId;
    const name = user_data.extData.list[0].nick;
    const response_note = await got({
        method: 'get',
        url: 'https://xhsapi.huitun.com/anchor/detail/notesV2?sort=0&anchorId=' + anchorId,
        headers: {
            Cookie: cookie,

View on GitHub (pinned to bed535e087)

Solutions

  1. Set `HUITUN_COOKIE` in the RSSHub environment configuration (`.env` or config file): add a `huitun: { cookie: 'your_cookie_here' }` entry.
  2. Obtain the cookie by logging into huitun.com, opening browser DevTools → Network, and copying the `Cookie` header from an authenticated API request.
  3. Note the free tier limits queries to 10/day; consider caching behavior and whether the cookie's quota is exhausted.

Example fix

// config (.env)
// before: HUITUN_COOKIE is unset

// after:
// HUITUN_COOKIE=PHPSESSID=xxxxx; other_cookie=yyyyy;
Defensive patterns

Strategy: validation

Validate before calling

import { config } from '@/config';
function isHuitunConfigured(): boolean {
    return Boolean(config.huitun?.cookie);
}
// The route already checks this at handler entry. Callers can check:
if (!isHuitunConfigured()) {
    throw new ConfigNotFoundError('HUITUN_COOKIE is not set');
}

Type guard

function hasHuitunCookie(cfg: typeof config): cfg is typeof config & { huitun: { cookie: string } } {
    return Boolean(cfg.huitun?.cookie);
}

Prevention

When it happens

Trigger: Calling `/huitun/xiaohongshu/<user_id>` on an RSSHub instance where the `HUITUN_COOKIE` config key is not set. This check runs before any network request.

Common situations: Self-hosted RSSHub deployment that didn't set the `HUITUN_COOKIE` environment variable, the cookie expired and was removed, or the config file is missing the `huitun` section entirely.

Related errors


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