{"record":{"id":"a75dc954ae70525d","repo":"DIYgod/RSSHub","slug":"pixiv-not-login-a75dc9","errorCode":null,"errorMessage":"pixiv not login","messagePattern":"pixiv not login","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/pixiv/novel-api/user-novels/nsfw.ts","lineNumber":36,"sourceCode":"        headers: {\n            ...maskHeader,\n            Authorization: 'Bearer ' + token,\n        },\n        searchParams: queryString.stringify({\n            user_id,\n            filter: 'for_ios',\n        }),\n    });\n}\n\nexport async function getNSFWUserNovels(id: string, fullContent: boolean = false, limit: number = 100): Promise<NovelList> {\n    if (!config.pixiv || !config.pixiv.refreshToken) {\n        throw new ConfigNotFoundError('This user is an R18 creator, PIXIV_REFRESHTOKEN is required.\\npixiv RSS is disabled due to the lack of relevant config.\\n該用戶爲 R18 創作者，需要 PIXIV_REFRESHTOKEN。');\n    }\n\n    const token = await getToken();\n    if (!token) {\n        throw new ConfigNotFoundError('pixiv not login');\n    }\n\n    const response = await getNovels(id, token);\n    const novels = limit ? response.data.novels.slice(0, limit) : response.data.novels;\n\n    if (novels.length === 0) {\n        throw new InvalidParameterError(`${id} is not a valid user ID, or the user has no novels.\\n${id} 不是有效的用戶 ID，或者該用戶沒有小說作品。`);\n    }\n\n    const username = novels[0].user.name;\n\n    const items = await Promise.all(\n        novels.map(async (novel) => {\n            const baseItem = {\n                title: novel.series?.title ? `${novel.series.title} - ${novel.title}` : novel.title,\n                description: `\n                    <img src=\"${pixivUtils.getProxiedImageUrl(novel.image_urls.large)}\" />\n                    <div>","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/pixiv/novel-api/user-novels/nsfw.ts#L18-L54","documentation":"Thrown by getNSFWUserNovels when getToken() returns falsy. The refreshToken guard already passed, so the OAuth token refresh itself failed and the in-memory token is null. Same root cause as the series-NSFW login error: configured but non-functional credentials.","triggerScenarios":"PIXIV_REFRESHTOKEN present but expired/revoked; pixiv oauth endpoint unreachable or rejecting the grant; region-blocked IP; previously cached empty access-token result under 'pixiv:accessToken'.","commonSituations":"Expired refresh token after prolonged use; server moved to a pixiv-blocked region; stale cache masking a refresh attempt; token obtained from the wrong pixiv account.","solutions":["Regenerate PIXIV_REFRESHTOKEN via the documented login flow and update config.","Make sure the host can reach oauth.secure.pixiv.net (proxy out of blocked regions).","Clear the 'pixiv:accessToken' cache entry so the refresh is retried.","Check RSSHub logs for the pixiv OAuth response error."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { getToken } from '../../token';\nconst token = await getToken();\nif (!token) {\n  // refresh failed: prompt operator to regenerate PIXIV_REFRESHTOKEN instead of calling getNovels","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-token invalid/expired: clear cache, advise regeneration\n  }\n}","preventionTips":["Do not call the authenticated app API when getToken() is null; it will 401 upstream.","Flush 'pixiv:accessToken' on null to avoid an hour of cached failure.","Log the oauth response to diagnose expiry vs. region block."],"tags":["pixiv","authentication","oauth","token","nsfw"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}