DIYgod/RSSHub · error · Error
Unknown type: ${v.type}
Error message
Unknown type: ${v.type} What it means
The dlnews route maps each article body block by its `type`. The switch handles `list` and `image`; any other `v.type` hits `default` and throws a generic Error, which fails the whole item (and propagates out of the Promise.all). This is an internal parser-completeness gap.
Source
Thrown at lib/routes/dlnews/category.tsx:100
} else {
switch (v.type) {
case 'header':
filteredData.push({ type: v.type, data: v.content });
break;
case 'list':
filteredData.push({ type: v.type, list_type: v.list_type, items: v.items });
break;
case 'image':
filteredData.push({ type: v.type, src: v.url, alt: v.alt_text, caption: v.subtitle });
break;
default:
throw new Error(`Unknown type: ${v.type}`);
}
}
}
item.description = renderDescription(filteredData);
return item;
});
export const route: Route = {
path: '/:category?',
radar: [
{
source: ['dlnews.com/articles/:category'],
target: '/:category',
},
],
url: 'dlnews.com/articles',
name: 'Latest News',
maintainers: ['Rjnishant530'],View on GitHub (pinned to bed535e087)
Solutions
- Find the new `type` value in the API response and add a rendering case.
- Return an empty string in the `default` arm as a graceful-degradation stopgap.
- Add a regression test that renders a payload containing every known block type.
Example fix
// before
// default:
// throw new Error(`Unknown type: ${v.type}`);
// after
// default:
// return ''; Defensive patterns
Strategy: fallback
Validate before calling
const HANDLED_BLOCK_TYPES = new Set(['list', 'image']);
function isHandledBlock(v: { type: string }): boolean {
return HANDLED_BLOCK_TYPES.has(v.type);
} Type guard
function isHandledBlock(v: { type: string }): v is { type: 'list' | 'image' } {
return v.type === 'list' || v.type === 'image';
} Try / catch
try {
renderBlock(v);
} catch {
// unknown block — skip it, keep the rest of the article
} Prevention
- Return '' in the default arm so one unknown block does not fail the article.
- Track unknown block types via telemetry.
- Replay a corpus of article payloads in CI to catch new block types early.
When it happens
Trigger: dlnews adds a new content-block type (e.g. heading, quote, embed, video, gallery) that the switch does not handle.
Common situations: An upstream content-model change ships new block types; the error appears only on articles that use the new blocks.
Related errors
- Unknown node type: ${node.type}
- Unhandle type: ${c.type}
- Unhandled attachment type: ${attachment.contentType} for pos
- Unhandled media type: ${media.mimetype}
- Unknown action key: ${item.key}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/d58ea5111ced48d5.
Report an issue: GitHub.