{"record":{"id":"b6a993de5dead11a","repo":"DIYgod/RSSHub","slug":"id-is-not-a-valid-user-id-or-the-user-has-no-n","errorCode":null,"errorMessage":"${id} is not a valid user ID, or the user has no novels.\n${id} 不是有效的用戶 ID，或者該用戶沒有小說作品。","messagePattern":"(.+?) is not a valid user ID, or the user has no novels\\.\n(.+?) 不是有效的用戶 ID，或者該用戶沒有小說作品。","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/pixiv/novel-api/user-novels/nsfw.ts","lineNumber":43,"sourceCode":"        }),\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>\n                    <p>${convertPixivProtocolExtended(novel.caption)}</p>\n                    </div>`,\n                author: novel.user.name,\n                pubDate: parseDate(novel.create_date),\n                link: `https://www.pixiv.net/novel/show.php?id=${novel.id}`,\n                category: novel.tags.map((t) => t.name),\n            };","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/pixiv/novel-api/user-novels/nsfw.ts#L25-L61","documentation":"InvalidParameterError thrown by getNSFWUserNovels after the authenticated /v1/user/novels call returns an empty novels array. Because auth already succeeded, an empty list means the user ID is wrong/deleted or the user genuinely has no novel works. The message is bilingual and names the offending id.","triggerScenarios":"Passing a non-existent or deleted pixiv user ID; a valid user who has published zero novels; a user whose only works are filtered out server-side.","commonSituations":"Copied a pixiv illust-only user ID into a novels route; ID typo; user deleted all novels; numeric ID truncated during copy.","solutions":["Confirm the id matches the numeric segment of https://www.pixiv.net/users/{id}/novels.","Open the user's profile and verify they have a Novels tab with works.","If the ID came from a third-party link, double-check it is the pixiv user ID and not an artwork or series ID.","Retry after confirming the account still exists."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function isValidPixivUserId(id: string): boolean {\n  return /^\\d+$/.test(id) && id.length > 0;\n}\n// before fetching:\nif (!isValidPixivUserId(id)) {\n  // reject as invalid user ID\n}","typeGuard":"const hasNovels = (resp: { data?: { novels?: unknown[] } }): boolean =>\n  Array.isArray(resp.data?.novels) && resp.data.novels.length > 0;","tryCatchPattern":"try {\n  return await getNSFWUserNovels(id, fullContent, limit);\n} catch (e) {\n  if (e instanceof InvalidParameterError && /not a valid user ID/.test(e.message)) {\n    // user has no novels or ID is wrong: show the bilingual hint, do not retry\n  }\n  throw e;\n}","preventionTips":["Validate the user ID is purely numeric before requesting.","Confirm the account has a Novels section before subscribing.","Treat empty-novels as a user-data condition, not a transient failure."],"tags":["pixiv","invalid-parameter","novel","user-id"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}