{"record":{"id":"328930d9f918b8a3","repo":"DIYgod/RSSHub","slug":"invalid-user-name","errorCode":null,"errorMessage":"Invalid user name","messagePattern":"Invalid user name","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/fanbox/index.ts","lineNumber":37,"sourceCode":"    name: 'Creator',\n    handler,\n    features: {\n        requireConfig: [\n            {\n                name: 'FANBOX_SESSION_ID',\n                description: 'Required for private posts. Can be found in browser DevTools -> Application -> Cookies -> https://www.fanbox.cc -> FANBOXSESSID',\n                optional: true,\n            },\n        ],\n        requirePuppeteer: true,\n        nsfw: true,\n    },\n};\n\nasync function handler(ctx: Context): Promise<Data> {\n    const creator = ctx.req.param('creator');\n    if (!isValidHost(creator)) {\n        throw new InvalidParameterError('Invalid user name');\n    }\n\n    let title = `Fanbox - ${creator}`;\n\n    let description: string | undefined;\n\n    let image: string | undefined;\n\n    try {\n        const userApi = `https://api.fanbox.cc/creator.get?creatorId=${creator}`;\n        const userInfoResponse = (await ofetch(userApi, {\n            headers: getHeaders(),\n        })) as UserInfoResponse;\n        title = `Fanbox - ${userInfoResponse.body.user.name}`;\n        description = userInfoResponse.body.description;\n        image = userInfoResponse.body.user.iconUrl;\n    } catch {\n        // ignore","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/fanbox/index.ts#L19-L55","documentation":"Thrown as an `InvalidParameterError` when the `creator` path parameter fails `isValidHost()`. The regex `/^[\\dA-Z](?:[\\dA-Z-]{0,61}[\\dA-Z])?$/i` ensures the creator handle is hostname-safe, because it is interpolated into both an API URL (`api.fanbox.cc/creator.get?creatorId=${creator}`) and the output feed link (`https://${creator}.fanbox.cc`). Characters like dots, underscores, or slashes are rejected.","triggerScenarios":"A user passes a creator name containing invalid characters — e.g., `user.name` (dot), `user_name` (underscore), `user/name` (slash), or an empty string. The isValidHost regex test fails before any Fanbox API call is made.","commonSituations":"User copies a full Fanbox URL instead of just the creator handle. User passes a Japanese character creator name that does not match the ASCII hostname regex. The creator handle contains a hyphen at the start or end (invalid per the regex).","solutions":["Pass only the creator handle as it appears in the Fanbox URL subdomain: e.g., `/fanbox/official` not `/fanbox/https://official.fanbox.cc`.","Ensure the handle contains only alphanumeric characters and internal hyphens.","If the creator handle legitimately contains unsupported characters, this route cannot serve it — check if Fanbox provides an alternative ID."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { isValidHost } from '@/utils/valid-host';\n\nfunction validateCreator(creator: string | undefined): string {\n    if (!creator || !isValidHost(creator)) {\n        throw new InvalidParameterError('Creator must be a hostname-safe string (alphanumeric and hyphens)');\n    }\n    return creator;\n}","typeGuard":"function isValidCreatorHandle(handle: string | undefined): boolean {\n    if (typeof handle !== 'string') return false;\n    return /^[\\dA-Z](?:[\\dA-Z-]{0,61}[\\dA-Z])?$/i.test(handle);\n}","tryCatchPattern":null,"preventionTips":["Pass only the creator handle as it appears in the Fanbox subdomain (e.g., 'official' from official.fanbox.cc).","Do not include URLs, protocols, or special characters.","Verify the handle exists by visiting https://<creator>.fanbox.cc in a browser."],"tags":["parameter-validation","hostname-validation","invalid-parameter-error","fanbox"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}