DIYgod/RSSHub · error · InvalidParameterError
User Not Found
Error message
User Not Found
What it means
Thrown by getUserId (sspai/author.ts:17) as an InvalidParameterError when the sspai user-resolution API (/api/v1/user/slug/info/get?slug=...) returns a non-zero error code. The handler only calls getUserId when the :id param is NOT pure digits (line 47: /^\d+/.test), so a numeric id bypasses this lookup entirely; slugs go through it. Because it is an InvalidParameterError, RSSHub surfaces it as an HTTP 400 with a localized 'invalid parameter' body rather than a 500.
Source
Thrown at lib/routes/sspai/author.ts:17
import InvalidParameterError from '@/errors/types/invalid-parameter';
import type { Route } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
async function getUserId(slug) {
const response = await got({
method: 'get',
url: `https://sspai.com/api/v1/user/slug/info/get?slug=${slug}`,
headers: {
Referer: `https://sspai.com/u/${slug}/posts`,
},
});
if (response.data.error !== 0) {
throw new InvalidParameterError('User Not Found');
}
return response.data.data.id;
}
export const route: Route = {
path: '/author/:id',
categories: ['new-media'],
example: '/sspai/author/796518',
parameters: { id: '作者 slug 或 id,slug 可在作者主页URL中找到,id 不易查找,仅作兼容' },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},View on GitHub (pinned to bed535e087)
Solutions
- Use the numeric author id form (e.g. /sspai/author/796518) — it skips the slug lookup entirely and cannot hit this error.
- Open https://sspai.com/u/<slug>/posts in a browser; if it 404s, the slug is wrong or the user is gone.
- Re-copy the slug verbatim from the current author-page URL on sspai.com (the path segment after /u/).
Example fix
// request - before GET /sspai/author/john-doe-renamed // request - after (use numeric id, or the correct current slug) GET /sspai/author/796518
Defensive patterns
Strategy: validation
Validate before calling
// Pre-check before depending on the slug resolving.
// Numeric ids bypass getUserId entirely; prefer them.
function prefersNumericId(id: string): boolean {
return /^\d+$/.test(id);
}
// If you must accept a slug, sanity-check it is non-empty and roughly
// slug-shaped before the route hits the sspai API.
function isPlausibleSspaiSlug(id: string): boolean {
return typeof id === 'string' && id.trim().length > 0 && /^[a-zA-Z0-9_-]+$/.test(id);
} Type guard
// Prefer the numeric-id form to skip the slug lookup entirely.
function isNumericAuthorId(id: string): id is string {
return /^\d+$/.test(id);
} Try / catch
try {
await fetchFeed('/sspai/author/' + id);
} catch (e) {
if (e instanceof Error && e.message === 'User Not Found') {
// surface a friendly 'unknown slug' message; suggest numeric id
}
throw e;
} Prevention
- Prefer the numeric author id (/sspai/author/796518) — it cannot throw this error.
- Source the slug only from the current sspai.com author URL, not from cached links.
- Strip whitespace from user-supplied ids before using them.
When it happens
Trigger: Requesting /sspai/author/<slug> where <slug> is a non-numeric string sspai does not recognize: a typo, a renamed/deleted account, or a slug containing characters sspai rejects. Also fires if a numeric id is passed with a stray letter/space so the /^\d+$/ regex fails and the value is treated as a slug.
Common situations: Copying a slug from an old/cached URL after the author renamed their sspai handle; the author deleted their account; pasting the numeric id with leading/trailing whitespace or a trailing letter; confusing the slug with the display name.
Related errors
- Invalid user
- Unsupported game: ${game}. Supported games: ${Object.keys(GA
- Novel not found in both APIs
- Invalid keyword
- Invalid type: ${type}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/f57dba3eac0220f7.
Report an issue: GitHub.