DIYgod/RSSHub · warning · InvalidParameterError
Invalid category
Error message
Invalid category
What it means
The cybersecurityventures news route accepts a category path parameter that must be one of the predefined keys in the categories object (today, intrusion-daily-cyber-threat-alert, ransomware-minute, cryptocrime, hack-blotter, cybersecurity-venture-capital-vc-deals, mergers-and-acquisitions-report). If the provided category string does not match any key, an InvalidParameterError is thrown with a clear 'Invalid category' message.
Source
Thrown at lib/routes/cybersecurityventures/news.ts:92
})),
},
},
handler,
maintainers: ['KarasuShin'],
features: {
supportRadar: true,
},
view: ViewType.Articles,
};
async function handler(ctx: Context): Promise<Data> {
const rootUrl = 'https://cybersecurityventures.com/';
const apiUrl = 'https://us-east-1-renderer-read.knack.com/v1';
const category = ctx.req.param('category') ?? 'today';
const limit = ctx.req.query('limit') ?? 20;
if (!Object.hasOwn(categories, category)) {
throw new InvalidParameterError('Invalid category');
}
const { scene, view, label } = categories[category];
const data = await ofetch<{
records: RawRecord[];
}>(`${apiUrl}/scenes/scene_${scene}/views/view_${view}/records?format=raw&page=1&rows_per_page=${limit}&sort_field=field_2&sort_order=desc`, {
headers: {
'X-Knack-Application-Id': '6013171b60be8f001cb27363',
'X-Knack-Rest-Api-Key': 'renderer',
},
});
return {
title: `${label} - Cybercrime Magazine`,
link: `${rootUrl}/${category}`,
item: data.records.map((item) => {
const $ = load(item.field_3, null, false);View on GitHub (pinned to bed535e087)
Solutions
- Check the route's parameters.options in the route definition to see the list of valid category values.
- Use one of the valid categories: today, intrusion-daily-cyber-threat-alert, ransomware-minute, cryptocrime, hack-blotter, cybersecurity-venture-capital-vc-deals, mergers-and-acquisitions-report.
- If you need a new category, add it to the categories object with the correct scene and view numbers from the Knack API.
Defensive patterns
Strategy: validation
Validate before calling
const category = ctx.req.param('category') ?? 'today';
const validCategories = ['today', 'intrusion-daily-cyber-threat-alert', 'ransomware-minute', 'cryptocrime', 'hack-blotter', 'cybersecurity-venture-capital-vc-deals', 'mergers-and-acquisitions-report'];
if (!validCategories.includes(category)) {
throw new InvalidParameterError(`Invalid category '${category}'. Valid options: ${validCategories.join(', ')}`);
} Type guard
function isValidCategory(cat: string): cat is keyof typeof categories {
return cat in categories;
} Prevention
- Always check the route's parameter options documentation before requesting.
- Use the default category ('today') if unsure.
- When adding new categories, update both the categories object and any documentation.
When it happens
Trigger: A user requests /cybersecurityventures/news/<category> where <category> is not a key in the categories dictionary. Object.hasOwn(categories, category) returns false. This is a pure input validation check before any API call is made.
Common situations: Typo in the category name (e.g., 'ransomware' instead of 'ransomware-minute'); user guesses a category name that doesn't exist; outdated documentation references a category that was removed; case sensitivity issue (e.g., 'Today' vs 'today').
Related errors
- At least one valid search parameter is required
- 无法检测 Discuz 版本,请在路由中指定版本参数,如 /discuz/x/ 或 /discuz/7/
- 通知类型${typeParam}未定义
- Unsupported language: ${language}
- Invalid type or subtype
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/d8dd4f0199b958c8.
Report an issue: GitHub.