DIYgod/RSSHub · error · Error
response.error.message
Error message
response.error.message
What it means
The gamer.com.tw anime API (video.php v3) returns a top-level error object when it cannot fulfill the request — for example an invalid or removed anime serial number (sn). The route checks for response.error and re-throws the API's own error.message verbatim, so the visible text depends entirely on what the API returns.
Source
Thrown at lib/routes/gamer/ani/anime.ts:40
target: '/anime/:sn',
},
],
name: '動畫瘋 - 動畫',
maintainers: ['maple3142', 'pseudoyu'],
handler,
};
async function handler(ctx) {
const { sn } = ctx.req.param();
const { data: response } = await got('https://api.gamer.com.tw/mobile_app/anime/v3/video.php', {
searchParams: {
sn,
},
});
if (response.error) {
throw new Error(response.error.message);
}
const anime = response.data.anime;
const title = anime.title.replaceAll(/\[\d+\]$/g, '').trim();
const items = anime.volumes[0]
.map((item) => ({
title: `${title} 第 ${item.volume} 集`,
description: `<img src="${item.cover}">`,
link: `https://ani.gamer.com.tw/animeVideo.php?sn=${item.video_sn}`,
}))
.toReversed();
return {
title,
link: `https://ani.gamer.com.tw/animeRef.php?sn=${anime.anime_sn}`,
description: anime.content?.trim(),
item: items,View on GitHub (pinned to bed535e087)
Solutions
- Open https://ani.gamer.com.tw, find the anime, and copy the current sn from the URL.
- Inspect the full response.error object to see if there is a code/hint (geoblock, removed, auth).
- Ensure required request headers ( referer, client cookies) are sent with the got call if gamer.com.tw enforces them.
- Validate sn is numeric before calling the API.
Example fix
// before
if (response.error) {
throw new Error(response.error.message);
}
// after
if (response.error) {
const snNum = Number(sn);
if (!Number.isFinite(snNum)) {
throw new InvalidParameterError(`sn must be numeric, got: ${sn}`);
}
throw new Error(`gamer.com.tw anime API error for sn=${sn}: ${response.error.message}`);
} Defensive patterns
Strategy: validation
Validate before calling
if (!/^\d+$/.test(sn)) {
throw new InvalidParameterError('sn must be numeric');
} Type guard
const isNumericSn = (v: string): v is string => /^\d+$/.test(v);
Prevention
- Validate sn is numeric before the API call. Include the sn in the thrown message for easier triage. Send any required referer/cookie headers gamer.com.tw expects.
When it happens
Trigger: Requesting an anime video.php resource with an sn that does not exist, has been removed/geoblocked, or the API rejects due to missing/invalid client headers. The API still returns HTTP 200 but with an error body.
Common situations: Users copying an outdated sn from an old link; anime being taken down regionally; gamer.com.tw tightening API access requiring specific headers or cookies; the sn being a non-numeric value.
Related errors
- Invalid tagId
- 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/ca3d97b5934414df.
Report an issue: GitHub.