{"record":{"id":"d8dd4f0199b958c8","repo":"DIYgod/RSSHub","slug":"invalid-category-d8dd4f","errorCode":null,"errorMessage":"Invalid category","messagePattern":"Invalid category","errorType":"exception","errorClass":"InvalidParameterError","httpStatus":null,"severity":"warning","filePath":"lib/routes/cybersecurityventures/news.ts","lineNumber":92,"sourceCode":"            })),\n        },\n    },\n    handler,\n    maintainers: ['KarasuShin'],\n    features: {\n        supportRadar: true,\n    },\n    view: ViewType.Articles,\n};\n\nasync function handler(ctx: Context): Promise<Data> {\n    const rootUrl = 'https://cybersecurityventures.com/';\n    const apiUrl = 'https://us-east-1-renderer-read.knack.com/v1';\n    const category = ctx.req.param('category') ?? 'today';\n    const limit = ctx.req.query('limit') ?? 20;\n\n    if (!Object.hasOwn(categories, category)) {\n        throw new InvalidParameterError('Invalid category');\n    }\n\n    const { scene, view, label } = categories[category];\n\n    const data = await ofetch<{\n        records: RawRecord[];\n    }>(`${apiUrl}/scenes/scene_${scene}/views/view_${view}/records?format=raw&page=1&rows_per_page=${limit}&sort_field=field_2&sort_order=desc`, {\n        headers: {\n            'X-Knack-Application-Id': '6013171b60be8f001cb27363',\n            'X-Knack-Rest-Api-Key': 'renderer',\n        },\n    });\n\n    return {\n        title: `${label} - Cybercrime Magazine`,\n        link: `${rootUrl}/${category}`,\n        item: data.records.map((item) => {\n            const $ = load(item.field_3, null, false);","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/cybersecurityventures/news.ts#L74-L110","documentation":"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.","triggerScenarios":"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.","commonSituations":"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').","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const category = ctx.req.param('category') ?? 'today';\nconst validCategories = ['today', 'intrusion-daily-cyber-threat-alert', 'ransomware-minute', 'cryptocrime', 'hack-blotter', 'cybersecurity-venture-capital-vc-deals', 'mergers-and-acquisitions-report'];\nif (!validCategories.includes(category)) {\n    throw new InvalidParameterError(`Invalid category '${category}'. Valid options: ${validCategories.join(', ')}`);\n}","typeGuard":"function isValidCategory(cat: string): cat is keyof typeof categories {\n    return cat in categories;\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["validation","input-validation","cybersecurityventures","invalid-parameter"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}