{"record":{"id":"909327af49587eff","repo":"DIYgod/RSSHub","slug":"pixiv-rss-is-disabled-due-to-the-lack-of-a-href-909327","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/search.ts","lineNumber":82,"sourceCode":"        },\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: 'Keyword',\n    maintainers: ['DIYgod'],\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 keyword = ctx.req.param('keyword');\n    const order = ctx.req.param('order') || 'date';\n    const mode = ctx.req.param('mode');\n    const includeAI = ctx.req.param('include_ai');\n\n    const token = await getToken();\n    if (!token) {\n        throw new ConfigNotFoundError('pixiv not login');\n    }\n\n    const response = await (order === 'popular' ? searchPopularIllust(keyword, token) : searchIllust(keyword, token));\n\n    let illusts = response.data.illusts;\n    if (mode === 'safe' || mode === '1') {\n        illusts = illusts.filter((item) => item.x_restrict === 0);\n    } else if (mode === 'r18' || mode === '2') {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/pixiv/search.ts#L64-L100","documentation":"ConfigNotFoundError thrown at the top of the pixiv keyword-search handler when config.pixiv or config.pixiv.refreshToken is falsy. Search is performed through the authenticated app API, so the token is required regardless of the requested mode (safe/r18).","triggerScenarios":"Calling /pixiv/search/:keyword/:order?/:mode?/:include_ai? with PIXIV_REFRESHTOKEN unset or empty; handler aborts before parsing the keyword.","commonSituations":"New deployment without pixiv credentials; env var removed during config refactor; operator assumed safe-mode search needs no auth.","solutions":["Configure PIXIV_REFRESHTOKEN and restart.","Confirm config.pixiv.refreshToken is populated at runtime.","Remember that even mode=safe search requires auth in this route.","Validate the env var name casing and source."],"exampleFix":"// before: PIXIV_REFRESHTOKEN unset\n// after (in .env):\nPIXIV_REFRESHTOKEN=your_refresh_token_here","handlingStrategy":"validation","validationCode":"import { config } from '@/config';\nfunction canSearchPixiv(): boolean {\n  return Boolean(config.pixiv && config.pixiv.refreshToken);\n}\nif (!canSearchPixiv()) {\n  // surface config notice; search needs auth even for safe mode\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  // search handler body\n} catch (e) {\n  if (e instanceof ConfigNotFoundError && /relevant config/.test(e.message)) {\n    // advise configuring PIXIV_REFRESHTOKEN\n  }\n}","preventionTips":["Search requires auth for all modes, including safe; document this clearly.","Gate the route on hasPixivAuth() before parsing parameters.","Run a startup check for the token."],"tags":["pixiv","config","authentication","search"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}