DIYgod/RSSHub · warning · InvalidParameterError
Unknown channel
Error message
Unknown channel
What it means
Thrown by the Guokr (果壳网) article channel route when the Guokr article API returns an empty result list for the requested channel. The handler maps user-facing channel names via `channelMap` (calendar→pac, institute/foodlab→predator, pretty→beauty) but also passes through any unknown channel key directly to the API. If the API returns zero articles, the route concludes the channel is invalid and throws `InvalidParameterError` (HTTP 400).
Source
Thrown at lib/routes/guokr/channel.ts:47
| -------- | ---------- | -------------- |
| calendar | institute | beauty |`,
};
async function handler(ctx) {
const channel = channelMap[ctx.req.param('channel')] ?? ctx.req.param('channel');
const { data: response } = await got('https://www.guokr.com/apis/minisite/article.json', {
searchParams: {
retrieve_type: 'by_wx',
channel_key: channel,
offset: 0,
limit: 10,
},
});
const result = parseList(response.result);
if (result.length === 0) {
throw new InvalidParameterError('Unknown channel');
}
const channelName = result[0].channels[0].name;
const channelUrl = result[0].channels[0].url;
const items = await Promise.all(result.map((item) => parseItem(item)));
return {
title: `果壳网 ${channelName}`,
link: channelUrl,
item: items,
};
}
View on GitHub (pinned to bed535e087)
Solutions
- Use one of the documented channels: `calendar`, `institute`, `foodlab`, `pretty`.
- Retry after a few minutes to rule out a transient empty-response issue.
- If the channel was recently retired, update the route description and `channelMap`.
Example fix
// before (broken) // GET /guokr/column/science // after (correct) // GET /guokr/column/calendar
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN_CHANNELS = ['calendar', 'institute', 'foodlab', 'pretty'];
function isValidChannel(channel: string): boolean {
return KNOWN_CHANNELS.includes(channel);
}
// Note: the API may also accept raw channel keys (pac, predator, beauty),
// but only the user-friendly aliases are documented. Type guard
function isKnownGuokrChannel(channel: string): boolean {
return ['calendar', 'institute', 'foodlab', 'pretty'].includes(channel);
} Prevention
- Pre-validate channel aliases before the API call to fail fast with a clear 400 error.
- Be aware that this error conflates 'invalid channel' with 'temporarily empty' — consider differentiating.
- Keep channelMap and the description table in sync.
When it happens
Trigger: Requesting `/guokr/column/<channel>` where `<channel>` is not a valid Guokr channel key, or where the channel exists but temporarily has zero articles. The API endpoint is `guokr.com/apis/minisite/article.json?channel_key=<channel>`.
Common situations: Typo in the channel slug, following a stale link to a channel that was retired, or a transient API issue returning an empty result set. Note that this error conflates 'invalid channel' with 'temporarily empty channel' — a valid channel with zero articles will also trigger it.
Related errors
- Bad category. See <a href="https://docs.rsshub.app/routes/ne
- Bad category. See <a href="https://docs.rsshub.app/routes/ne
- Bad category. See <a href="https://docs.rsshub.app/routes/ne
- Unknown channel type: ${type}. Valid values: ${Object.keys(C
- Bad category. See <a href="https://docs.rsshub.app/routes/go
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/e7582b1316541cb7.
Report an issue: GitHub.