{"record":{"id":"60552bb7efc93e1e","repo":"DIYgod/RSSHub","slug":"pixiv-not-login-60552b","errorCode":null,"errorMessage":"pixiv not login","messagePattern":"pixiv not login","errorType":"error_code","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/pixiv/search.ts","lineNumber":92,"sourceCode":"    },\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') {\n        illusts = illusts.filter((item) => item.x_restrict === 1);\n    }\n\n    if (includeAI === 'no' || includeAI === '0') {\n        illusts = illusts.filter((item) => item.illust_ai_type <= 1);\n    }\n\n    return {\n        title: `${keyword} 的 pixiv ${order === 'popular' ? '热门' : ''}内容`,\n        link: `https://www.pixiv.net/tags/${keyword}/artworks`,","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/pixiv/search.ts#L74-L110","documentation":"ConfigNotFoundError thrown by the search handler when getToken() returns falsy. The refresh-token guard passed, so the OAuth refresh itself failed and no access token is available for the search API call.","triggerScenarios":"PIXIV_REFRESHTOKEN present but expired, revoked, or rejected by pixiv oauth; network/region block; cached empty token under 'pixiv:accessToken'.","commonSituations":"Stale/expired refresh token; server IP blocked by pixiv; failed refresh cached for an hour.","solutions":["Obtain a new PIXIV_REFRESHTOKEN and replace the configured value.","Ensure oauth.secure.pixiv.net is reachable from the host.","Clear the 'pixiv:accessToken' cache to force a fresh refresh.","Read the pixiv oauth error from logs."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { getToken } from './token';\nconst token = await getToken();\nif (!token) {\n  // abort search; refresh failed, regenerate PIXIV_REFRESHTOKEN\n}","typeGuard":"const isUsableToken = (t: unknown): t is string => typeof t === 'string' && t.length > 0;","tryCatchPattern":"try {\n  const token = await getToken();\n  if (!token) throw new ConfigNotFoundError('pixiv not login');\n} catch (e) {\n  if (e instanceof ConfigNotFoundError) {\n    // refresh failed: clear cache, advise token regeneration\n  }\n}","preventionTips":["Avoid calling the search API with a null token.","Invalidate 'pixiv:accessToken' on null results.","Log oauth responses to distinguish expiry from region block."],"tags":["pixiv","authentication","oauth","token","search"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}