{"record":{"id":"6c52c33a4d9d0e38","repo":"DIYgod/RSSHub","slug":"invalid-type-paramtype-please-refer-to-the-d","errorCode":null,"errorMessage":"Invalid type: ${paramType}. Please refer to [the documentation](https://docs.rsshub.app/routes/other#${siteTitle}) for valid types.","messagePattern":"Invalid type: (.+?)\\. Please refer to \\[the documentation\\]\\(https://docs\\.rsshub\\.app/routes/other#(.+?)\\) for valid types\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/iresearch/report.ts","lineNumber":211,"sourceCode":"        label: '其他',\n        value: '81',\n    },\n];\n\nconst defaultType = 1;\nconst siteTitle = '艾瑞咨询';\n\ninterface ReportItem extends DataItem {\n    detailId?: string | number;\n}\n\nexport const handler = async (ctx: Context): Promise<Data> => {\n    const { type: paramType = defaultType, id: paramId = '' } = ctx.req.param();\n    const limit = Number(ctx.req.query('limit') ?? '50');\n\n    const typeObj = types?.[paramType] ?? Object.values(types).find((obj) => obj.label === paramType || obj.value === paramType);\n    if (!typeObj) {\n        throw new Error(`Invalid type: ${paramType}. Please refer to [the documentation](https://docs.rsshub.app/routes/other#${siteTitle}) for valid types.`);\n    }\n\n    const idObj = idOptions.find((option) => option.label === paramId || option.value === paramId);\n\n    const type: number = typeObj.value;\n    const id: string | undefined = idObj ? String(idObj.value) : undefined;\n\n    const baseUrl = 'https://www.iresearch.com.cn';\n    const imageBaseUrl = 'https://pic.iresearch.cn';\n    const targetUrl: string = new URL(`report.shtml?type=${type}${id ? `&classId=${id}` : ''}`, baseUrl).href;\n    const apiUrl: string = new URL(`api/${typeObj.slug}`, baseUrl).href;\n    const apiDetailUrl: string = new URL(`api/${typeObj.detailSlug}`, baseUrl).href;\n\n    const response = await ofetch(apiUrl, {\n        query: {\n            ...(id && {\n                [typeObj.idKey]: id,\n            }),","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/iresearch/report.ts#L193-L229","documentation":"Thrown by the 艾瑞咨询 (iresearch) report route when the `type` path/query param does not match any key in the `types` map and is not equal to any type's `label` or `value`. Plain `Error` (not `InvalidParameterError`). The message points users to the docs for the valid type list.","triggerScenarios":"Request to the iresearch route with a `type` not present in the route's `types` config and not matching any `label`/`value`. E.g. `/iresearch/report/foo` where `foo` is unknown. Fires at report.ts:211 after both the direct-key and label/value fallback lookups fail.","commonSituations":"Typo in the type param; user references a type from outdated docs; the route's `types` map was refactored and a previously-valid type was removed.","solutions":["Consult the route's `description`/docs (https://docs.rsshub.app/routes/other#艾瑞咨询) for the current valid type list and use one of those values.","If extending the route, add the new type to the `types` map in lib/routes/iresearch/report.ts.","Use the type's `value` or `label` (both are accepted by the fallback lookup)."],"exampleFix":"// before: GET /iresearch/report/unknownType\n// after: use a documented type, e.g.\nGET /iresearch/report/industry","handlingStrategy":"validation","validationCode":"const typeObj = types?.[paramType] ?? Object.values(types).find(o => o.label === paramType || o.value === paramType);\nif (!typeObj) throw new InvalidParameterError(`Invalid type: ${paramType}. Valid: ${Object.keys(types).join(', ')}`);","typeGuard":"const isKnownType = (t: string) => Boolean(types[t]) || Object.values(types).some(o => o.label === t || String(o.value) === t);","tryCatchPattern":null,"preventionTips":["Use InvalidParameterError (not plain Error) for param validation so it surfaces as a 4xx, not 500.","Surface the valid set in the error message.","Keep the types map as the single source of truth shared with the route description."],"tags":["iresearch","invalid-parameter","route-validation"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}