{"record":{"id":"c894107af9e4bd7c","repo":"DIYgod/RSSHub","slug":"invalid-user-c89410","errorCode":null,"errorMessage":"Invalid user","messagePattern":"Invalid user","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/medium/feed.ts","lineNumber":36,"sourceCode":"        supportPodcast: false,\n        supportScihub: false,\n    },\n    radar: [\n        {\n            source: ['medium.com/@:user'],\n            target: '/feed/:user',\n        },\n    ],\n    name: 'Medium Feed',\n    maintainers: ['pseudoyu'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const user = ctx.req.param('user');\n\n    if (!user) {\n        throw new InvalidParameterError('Invalid user');\n    }\n\n    const feed = await parser.parseURL(`https://medium.com/feed/@${user}`);\n\n    return {\n        title: feed.title ?? 'Medium',\n        description: feed.description ?? `${user}'s Medium`,\n        link: feed.link ?? `https://medium.com/@${user}`,\n        image: feed.image?.url ?? '',\n        item: feed.items.map((item) => ({\n            title: item.title ?? 'Untitled',\n            description: item['content:encoded'] ?? item.content ?? '',\n            link: item.link ?? '',\n            pubDate: item.pubDate ? parseDate(item.pubDate) : undefined,\n            guid: item.guid ?? '',\n            author: item.creator ?? user,\n        })),\n    };","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/medium/feed.ts#L18-L54","documentation":"Thrown as an InvalidParameterError when the 'user' path parameter is falsy. The route /medium/feed/:user requires a non-empty username, so this guards against requests where the user segment is missing or empty.","triggerScenarios":"A request to the Medium feed route where ctx.req.param('user') returns an empty string or undefined — e.g. a malformed URL like /medium/feed/ or /medium/feed (with the segment stripped by a proxy).","commonSituations":"Misconfigured RSS reader with an empty Medium handle; URL-rewriting proxy dropping the trailing segment; typo where the user segment is blank; radar rule mismatch producing an empty capture.","solutions":["Supply a non-empty Medium username in the URL, e.g. /medium/feed/johndoe.","If building the URL programmatically, validate the user variable is a non-empty string before constructing the path.","Do not include the leading @ in some configurations — confirm the expected format.","Check that no URL shortener or rewrite rule strips the final path segment."],"exampleFix":"// before\nconst url = `/medium/feed/${user}`; // user === ''\n\n// after\nif (!user) throw new Error('user required');\nconst url = `/medium/feed/${user}`;","handlingStrategy":"validation","validationCode":"const user = ctx.req.param('user');\nif (!user || typeof user !== 'string' || !user.trim()) {\n    throw new InvalidParameterError('Medium username required');\n}","typeGuard":"function isNonEmptyUser(user: unknown): user is string {\n    return typeof user === 'string' && user.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Validate path params at the route entry, before any network call.","Add a route-level regex constraint so empty users never reach the handler."],"tags":["medium","validation","user-input"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}