{"record":{"id":"bb8a29e01029cddf","repo":"DIYgod/RSSHub","slug":"pixiv-rss-is-disabled-due-to-the-lack-of-a-href-bb8a29","errorCode":null,"errorMessage":"pixiv RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>","messagePattern":"pixiv RSS is disabled due to the lack of <a href=\"https://docs\\.rsshub\\.app/deploy/config#route-specific-configurations\">relevant config</a>","errorType":"error_code","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/pixiv/ranking.ts","lineNumber":148,"sourceCode":"        date: 'format: `2018-4-25`',\n    },\n    features: {\n        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n        nsfw: true,\n    },\n    name: 'Rankings',\n    maintainers: ['EYHN'],\n    handler,\n};\n\nasync function handler(ctx) {\n    if (!config.pixiv || !config.pixiv.refreshToken) {\n        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>');\n    }\n\n    const mode = alias[ctx.req.param('mode')] ?? ctx.req.param('mode');\n    const date = ctx.req.param('date') ? new Date(ctx.req.param('date')) : new Date();\n\n    const token = await getToken();\n    if (!token) {\n        throw new ConfigNotFoundError('pixiv not login');\n    }\n\n    const response = await getRanking(mode, ctx.req.param('date') && date, token);\n\n    const illusts = response.data.illusts;\n\n    const dateStr = `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日 `;\n\n    return {\n        title: (ctx.req.param('date') ? dateStr : '') + titles[mode],","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/pixiv/ranking.ts#L130-L166","documentation":"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.","triggerScenarios":"Requesting /pixiv/ranking/:mode/:date? with no PIXIV_REFRESHTOKEN in the environment; the handler aborts before reading mode or date.","commonSituations":"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.","solutions":["Set PIXIV_REFRESHTOKEN per the deploy docs and restart RSSHub.","Verify the value is non-empty at runtime.","Note rankings require auth even for non-R18 modes; there is no SFW fallback for this route.","Ensure the secrets/env provider actually injects the variable into the Node process."],"exampleFix":"// before: no pixiv env\n// after (in .env):\nPIXIV_REFRESHTOKEN=your_refresh_token_here","handlingStrategy":"validation","validationCode":"import { config } from '@/config';\nfunction canFetchRanking(): boolean {\n  return Boolean(config.pixiv && config.pixiv.refreshToken);\n}\nif (!canFetchRanking()) {\n  // return a clear 'configure PIXIV_REFRESHTOKEN' notice\n}","typeGuard":"const hasPixivAuth = (c: typeof config): c is typeof config & { pixiv: { refreshToken: string } } =>\n  Boolean(c.pixiv && typeof c.pixiv.refreshToken === 'string' && c.pixiv.refreshToken.length > 0);","tryCatchPattern":"try {\n  // ranking handler body\n} catch (e) {\n  if (e instanceof ConfigNotFoundError) {\n    // rankings need auth: surface config guidance, no retry\n  }\n}","preventionTips":["Rankings have no SFW fallback; always require PIXIV_REFRESHTOKEN.","Add a startup self-test for the token so misconfiguration is caught early.","Document that even non-R18 ranking modes need auth."],"tags":["pixiv","config","authentication","ranking"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}