{"record":{"id":"29684050695385ba","repo":"DIYgod/RSSHub","slug":"invalid-section-sectionparam-valid-sections-a","errorCode":null,"errorMessage":"Invalid section: ${sectionParam}. Valid sections are: ${Object.keys(SECTION_LABELS).join(', ')}","messagePattern":"Invalid section: (.+?)\\. Valid sections are: (.+?)","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"warning","filePath":"lib/routes/hudsonrivertrading/index.ts","lineNumber":84,"sourceCode":"| /hudsonrivertrading/blog | All Posts |\n${Object.entries(SECTION_LABELS)\n    .map(([key, label]) => `| /hudsonrivertrading/blog/${key} | ${label} |`)\n    .join('\\n')}`,\n};\n\nasync function handler(ctx): Promise<Data> {\n    const sectionParam = (ctx.req.param('section') ?? '').toLowerCase();\n    const apiBase = `${ROOT_URL}/wp-json/wp/v2`;\n\n    // Build query using fixed category IDs\n    let categoriesQuery: { include?: number; exclude?: number[] } | undefined;\n    if (sectionParam) {\n        if (Object.hasOwn(SECTION_CATEGORY_IDS, sectionParam)) {\n            categoriesQuery = { include: SECTION_CATEGORY_IDS[sectionParam] };\n        } else if (sectionParam === 'more') {\n            categoriesQuery = { exclude: Object.values(SECTION_CATEGORY_IDS) };\n        } else {\n            throw new InvalidParameterError(`Invalid section: ${sectionParam}. Valid sections are: ${Object.keys(SECTION_LABELS).join(', ')}`);\n        }\n    }\n    // If sectionParam is empty/undefined, categoriesQuery remains undefined = all posts\n\n    const searchParams: string[] = ['per_page=20', '_embed=author,wp:term'];\n    if (categoriesQuery?.include) {\n        searchParams.push(`categories=${categoriesQuery.include}`);\n    }\n    if (categoriesQuery?.exclude?.length) {\n        searchParams.push(`categories_exclude=${categoriesQuery.exclude.join(',')}`);\n    }\n\n    const apiUrl = `${apiBase}/posts?${searchParams.join('&')}`;\n    const data = await ofetch<WordpressPost[]>(apiUrl);\n\n    const items = data.map((post) => ({\n        title: post.title?.rendered,\n        description: post.content?.rendered ?? post.excerpt?.rendered ?? '',","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/hudsonrivertrading/index.ts#L66-L102","documentation":"Thrown by the Hudson River Trading tech blog route when the `:section` path parameter is non-empty but does not match any key in `SECTION_CATEGORY_IDS` (algo, engineers, interns) and is not the special value `more`. The route uses WordPress REST API category IDs to filter posts. The error message lists all valid section keys from `SECTION_LABELS`.","triggerScenarios":"Requesting `/hudsonrivertrading/blog/<section>` where `<section>` is not `algo`, `engineers`, `interns`, or `more`. The parameter is case-insensitive (lowercased at line 73) but must match one of those four exact strings.","commonSituations":"Typo in the section name, using a plural or variant (e.g. `intern`, `engineering`), or guessing a section that doesn't exist. The `parameters.options` field in the route config enumerates valid values for documentation.","solutions":["Use one of: `algo`, `engineers`, `interns`, or `more`.","Omit the section entirely to get all posts: `/hudsonrivertrading/blog`."],"exampleFix":"// before (broken)\n// GET /hudsonrivertrading/blog/intern\n\n// after (correct)\n// GET /hudsonrivertrading/blog/interns","handlingStrategy":"validation","validationCode":"const VALID_SECTIONS = Object.keys(SECTION_LABELS); // ['algo', 'engineers', 'interns', 'more']\nfunction isValidSection(section: string): boolean {\n    return VALID_SECTIONS.includes(section.toLowerCase());\n}","typeGuard":"function isValidHrtSection(section: string): section is 'algo' | 'engineers' | 'interns' | 'more' {\n    return section.toLowerCase() in SECTION_LABELS;\n}","tryCatchPattern":null,"preventionTips":["Use the `parameters.options` field to expose valid sections in auto-generated documentation.","Omit the section parameter to get all posts without filtering.","Validate case-insensitively before the API call."],"tags":["parameter-validation","rsshub","blog"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}