DIYgod/RSSHub · error · ConfigNotFoundError

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

Error message

pixiv 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

ConfigNotFoundError thrown at the top of the pixiv ranking handler when config.pixiv or config.pixiv.refreshToken is falsy. All pixiv rankings (including non-R18 ones) are fetched through the authenticated app API, so a token is mandatory. The message links to the deploy config docs.

Source

Thrown at lib/routes/pixiv/ranking.ts:148

        date: 'format: `2018-4-25`',
    },
    features: {
        requireConfig: false,
        requirePuppeteer: false,
        antiCrawler: false,
        supportBT: false,
        supportPodcast: false,
        supportScihub: false,
        nsfw: true,
    },
    name: 'Rankings',
    maintainers: ['EYHN'],
    handler,
};

async function handler(ctx) {
    if (!config.pixiv || !config.pixiv.refreshToken) {
        throw new ConfigNotFoundError('pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/deploy/config#route-specific-configurations">relevant config</a>');
    }

    const mode = alias[ctx.req.param('mode')] ?? ctx.req.param('mode');
    const date = ctx.req.param('date') ? new Date(ctx.req.param('date')) : new Date();

    const token = await getToken();
    if (!token) {
        throw new ConfigNotFoundError('pixiv not login');
    }

    const response = await getRanking(mode, ctx.req.param('date') && date, token);

    const illusts = response.data.illusts;

    const dateStr = `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日 `;

    return {
        title: (ctx.req.param('date') ? dateStr : '') + titles[mode],

View on GitHub (pinned to bed535e087)

Solutions

  1. Set PIXIV_REFRESHTOKEN per the deploy docs and restart RSSHub.
  2. Verify the value is non-empty at runtime.
  3. Note rankings require auth even for non-R18 modes; there is no SFW fallback for this route.
  4. Ensure the secrets/env provider actually injects the variable into the Node process.

Example fix

// before: no pixiv env
// after (in .env):
PIXIV_REFRESHTOKEN=your_refresh_token_here
Defensive patterns

Strategy: validation

Validate before calling

import { config } from '@/config';
function canFetchRanking(): boolean {
  return Boolean(config.pixiv && config.pixiv.refreshToken);
}
if (!canFetchRanking()) {
  // return a clear 'configure PIXIV_REFRESHTOKEN' notice
}

Type guard

const hasPixivAuth = (c: typeof config): c is typeof config & { pixiv: { refreshToken: string } } =>
  Boolean(c.pixiv && typeof c.pixiv.refreshToken === 'string' && c.pixiv.refreshToken.length > 0);

Try / catch

try {
  // ranking handler body
} catch (e) {
  if (e instanceof ConfigNotFoundError) {
    // rankings need auth: surface config guidance, no retry
  }
}

Prevention

When it happens

Trigger: Requesting /pixiv/ranking/:mode/:date? with no PIXIV_REFRESHTOKEN in the environment; the handler aborts before reading mode or date.

Common situations: Default RSSHub install with no pixiv credentials; env var unset in production; rankings are the first pixiv route an operator tries, so this is the most common pixiv config error.

Related errors


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