{"record":{"id":"7b361196a49679a2","repo":"DIYgod/RSSHub","slug":"pixiv-not-login-7b3611","errorCode":null,"errorMessage":"pixiv not login","messagePattern":"pixiv not login","errorType":"error_code","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/pixiv/ranking.ts","lineNumber":156,"sourceCode":"        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],\n        link: links[mode],\n        description: dateStr + titles[mode],\n        item: illusts.map((illust, index) => {\n            const images = pixivUtils.getImgs(illust);\n            return {\n                title: `#${index + 1} ${illust.title}`,\n                pubDate: parseDate(illust.create_date),\n                description: `${illust.caption}<br><p>画师：${illust.user.name} - 阅览数：${illust.total_view} - 收藏数：${illust.total_bookmarks}</p><br>${images.join('')}`,","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/pixiv/ranking.ts#L138-L174","documentation":"ConfigNotFoundError thrown by the ranking handler when getToken() returns falsy after the config guard passed. The OAuth refresh against oauth.secure.pixiv.net did not yield an access_token, leaving the module token null. Indicates configured-but-broken credentials.","triggerScenarios":"PIXIV_REFRESHTOKEN present but expired/revoked/invalid; oauth endpoint unreachable or region-blocked; empty token result cached for up to an hour under 'pixiv:accessToken'.","commonSituations":"Long-running token finally expired; server relocated behind a pixiv-blocked network; cache poisoned with a failed refresh result.","solutions":["Regenerate and set a fresh PIXIV_REFRESHTOKEN.","Ensure network reachability to oauth.secure.pixiv.net (proxy if needed).","Invalidate the 'pixiv:accessToken' cache entry.","Inspect the OAuth response in logs to see pixiv's rejection reason."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { getToken } from './token';\nconst token = await getToken();\nif (!token) {\n  // abort ranking fetch; prompt token regeneration\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 regenerating token\n  }\n}","preventionTips":["Do not call getRanking with a null token; it will fail upstream.","Clear the 'pixiv:accessToken' cache when getToken() is null.","Monitor oauth refresh failures to catch token expiry."],"tags":["pixiv","authentication","oauth","token","ranking"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}