DIYgod/RSSHub · warning · Error
Invalid channel format. Missing -id
Error message
Invalid channel format. Missing -id
What it means
Thrown by the Castbox channel route when the `channel` parameter does not contain the `-id` delimiter or has nothing after it. The handler splits on '-id' with limit 2 and reads index [1]; if the pattern is absent, index [1] is undefined and the guard trips. Plain `Error`, not `InvalidParameterError`.
Source
Thrown at lib/routes/castbox/channel.ts:56
supportScihub: false,
},
radar: [
{
source: ['castbox.fm/channel/:channel'],
target: '/channel/:channel',
},
],
name: 'Channels',
description: `Get the channel from the Castbox channel URL. For example, the URL of the channel "Lemonade Stand" is \`https://castbox.fm/channel/Lemonade-Stand-id6776228\`, where \`Lemonade-Stand-id6776228\` is the \`channel\` parameter.
You can use the RSSHub global \`limit\` query parameter to specify the maximum number of episodes to fetch from the Castbox API (defaults to 50). For example: \`/castbox/channel/Lemonade-Stand-id6776228?limit=100\`.`,
maintainers: ['ananyatimalsina'],
handler: async (ctx) => {
const { channel } = ctx.req.param();
const cid = channel.split('-id', 2)[1];
if (!cid) {
throw new Error('Invalid channel format. Missing -id');
}
const channelParams = { cid, r: 1, raw: 1, web: 1 };
const { m: cm, n: cn, queryStr: cQuery } = getNonce(channelParams);
const channelData = await ofetch(`https://everest.castbox.fm/data/channel/v3?${cQuery}&m=${cm}&n=${cn}`);
if (!channelData?.data) {
throw new Error('Failed to fetch channel data from Castbox');
}
const chData = channelData.data;
const limit = ctx.req.query('limit') ? Number(ctx.req.query('limit') as string) : 50;
const epParams = { cid, limit, r: 1, raw: 1, web: 1 };
const { m: em, n: en, queryStr: eQuery } = getNonce(epParams);
const epData = await ofetch(`https://everest.castbox.fm/data/episode_list/v2?${eQuery}&m=${em}&n=${en}`);View on GitHub (pinned to bed535e087)
Solutions
- Pass the full channel identifier including the `-id<digits>` suffix, e.g. `/castbox/channel/Lemonade-Stand-id6776228`.
- Copy the value verbatim from the castbox.fm channel URL path.
- Maintainers: use `InvalidParameterError` and consider a stricter regex `/^(.+)-id(\d+)$/` to also reject non-numeric ids.
Example fix
// before /castbox/channel/Lemonade-Stand // after /castbox/channel/Lemonade-Stand-id6776228
Defensive patterns
Strategy: validation
Validate before calling
function extractCastboxCid(channel: string): string | null {
const m = channel.match(/-id(\d+)$/);
return m ? m[1] : null;
}
const cid = extractCastboxCid(channel);
if (!cid) {
throw new Error(`Channel '${channel}' is missing the -id<digits> suffix`);
} Type guard
function hasCastboxIdSuffix(channel: string): boolean {
return /-id\d+$/.test(channel);
} Prevention
- Always copy the channel identifier verbatim from the castbox.fm URL.
- Maintainers: switch to a strict regex and `InvalidParameterError` for clearer 400 responses.
When it happens
Trigger: Supplying a channel slug without the `-id<digits>` suffix, e.g. `/castbox/channel/Lemonade-Stand`, or a slug ending exactly at `-id` with no trailing id (`...-id`).
Common situations: User copies only the human-readable slug portion of the URL and drops the `-id6776228` tail, or the source site changes its URL format.
Related errors
- Invalid type parameter
- unknown site: ${site}
- Invalid type parameter
- Invalid category: ${category}
- Invalid column
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/97fe0a25acb6e5e5.
Report an issue: GitHub.