DIYgod/RSSHub · error · InvalidParameterError
Invalid user
Error message
Invalid user
What it means
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.
Source
Thrown at lib/routes/medium/feed.ts:36
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['medium.com/@:user'],
target: '/feed/:user',
},
],
name: 'Medium Feed',
maintainers: ['pseudoyu'],
handler,
};
async function handler(ctx) {
const user = ctx.req.param('user');
if (!user) {
throw new InvalidParameterError('Invalid user');
}
const feed = await parser.parseURL(`https://medium.com/feed/@${user}`);
return {
title: feed.title ?? 'Medium',
description: feed.description ?? `${user}'s Medium`,
link: feed.link ?? `https://medium.com/@${user}`,
image: feed.image?.url ?? '',
item: feed.items.map((item) => ({
title: item.title ?? 'Untitled',
description: item['content:encoded'] ?? item.content ?? '',
link: item.link ?? '',
pubDate: item.pubDate ? parseDate(item.pubDate) : undefined,
guid: item.guid ?? '',
author: item.creator ?? user,
})),
};View on GitHub (pinned to bed535e087)
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.
Example fix
// before
const url = `/medium/feed/${user}`; // user === ''
// after
if (!user) throw new Error('user required');
const url = `/medium/feed/${user}`; Defensive patterns
Strategy: validation
Validate before calling
const user = ctx.req.param('user');
if (!user || typeof user !== 'string' || !user.trim()) {
throw new InvalidParameterError('Medium username required');
} Type guard
function isNonEmptyUser(user: unknown): user is string {
return typeof user === 'string' && user.trim().length > 0;
} Prevention
- Validate path params at the route entry, before any network call.
- Add a route-level regex constraint so empty users never reach the handler.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- id 为 ${catalogId} 的 List 不存在
- Invalid type parameter
- unknown site: ${site}
- Invalid type parameter
- Invalid category: ${category}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/c894107af9e4bd7c.
Report an issue: GitHub.