{"record":{"id":"e7582b1316541cb7","repo":"DIYgod/RSSHub","slug":"unknown-channel","errorCode":null,"errorMessage":"Unknown channel","messagePattern":"Unknown channel","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"warning","filePath":"lib/routes/guokr/channel.ts","lineNumber":47,"sourceCode":"| -------- | ---------- | -------------- |\n| calendar | institute  | beauty         |`,\n};\n\nasync function handler(ctx) {\n    const channel = channelMap[ctx.req.param('channel')] ?? ctx.req.param('channel');\n\n    const { data: response } = await got('https://www.guokr.com/apis/minisite/article.json', {\n        searchParams: {\n            retrieve_type: 'by_wx',\n            channel_key: channel,\n            offset: 0,\n            limit: 10,\n        },\n    });\n    const result = parseList(response.result);\n\n    if (result.length === 0) {\n        throw new InvalidParameterError('Unknown channel');\n    }\n\n    const channelName = result[0].channels[0].name;\n    const channelUrl = result[0].channels[0].url;\n\n    const items = await Promise.all(result.map((item) => parseItem(item)));\n\n    return {\n        title: `果壳网 ${channelName}`,\n        link: channelUrl,\n        item: items,\n    };\n}\n","sourceCodeStart":29,"sourceCodeEnd":61,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/guokr/channel.ts#L29-L61","documentation":"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).","triggerScenarios":"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>`.","commonSituations":"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.","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`."],"exampleFix":"// before (broken)\n// GET /guokr/column/science\n\n// after (correct)\n// GET /guokr/column/calendar","handlingStrategy":"validation","validationCode":"const KNOWN_CHANNELS = ['calendar', 'institute', 'foodlab', 'pretty'];\nfunction isValidChannel(channel: string): boolean {\n    return KNOWN_CHANNELS.includes(channel);\n}\n// Note: the API may also accept raw channel keys (pac, predator, beauty),\n// but only the user-friendly aliases are documented.","typeGuard":"function isKnownGuokrChannel(channel: string): boolean {\n    return ['calendar', 'institute', 'foodlab', 'pretty'].includes(channel);\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["parameter-validation","api","rsshub","new-media"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}