{"record":{"id":"6650962e9225ac83","repo":"DIYgod/RSSHub","slug":"invalid-team-name","errorCode":null,"errorMessage":"Invalid team name","messagePattern":"Invalid team name","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"lib/routes/hupu/news.ts","lineNumber":25,"sourceCode":"import { getEntryDetails } from './utils';\n\nexport const route: Route = {\n    path: '/news/:team',\n    name: '队伍新闻',\n    url: 'm.hupu.com',\n    maintainers: ['hyoban'],\n    example: '/hupu/news/Spurs',\n    parameters: {\n        team: {\n            description: '全小写的英文队名，例如：spurs, lakers, warriors 等等',\n        },\n    },\n    categories: ['bbs'],\n    handler: async (ctx): Promise<Data> => {\n        const team = NBA_TEAMS_ID_MAP[ctx.req.param('team')!];\n        const teamId = team?.teamId;\n        if (!teamId) {\n            throw new Error('Invalid team name');\n        }\n        const data = await ofetch(`https://games.mobileapi.hupu.com/3/7.5.60/basketballapi/news/v2/teamNewsById?cateGoryCode=basketball&clientId=93977196&newsId=0&teamId=${teamId}`);\n\n        let items: DataItem[] = data.result.map((item) => ({\n            title: item.title,\n            guid: item.tid,\n            link: `https://m.hupu.com/bbs/${item.tid}`,\n            pubDate: timezone(parseDate(item.publishTime), 8),\n        }));\n\n        items = await Promise.all(items.map((item) => getEntryDetails(item)));\n\n        return {\n            title: `虎扑 - ${team.teamName} 新闻`,\n            link: 'https://m.hupu.com',\n            item: items,\n        } as Data;\n    },","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/hupu/news.ts#L7-L43","documentation":"Thrown by the Hupu NBA team news route when the `:team` path parameter does not match any key in `NBA_TEAMS_ID_MAP`. The handler looks up the team slug to obtain a numeric `teamId` used in the Hupu basketball API. If the slug is not found or the found entry lacks a `teamId`, the route throws a plain `Error` (not `InvalidParameterError`).","triggerScenarios":"Requesting `/hupu/news/<team>` where `<team>` is not a recognized NBA team slug in the `NBA_TEAMS_ID_MAP` constant. The description says to use lowercase English team names like `spurs`, `lakers`, `warriors`.","commonSituations":"Typo in the team name, using a city name instead of the team nickname (e.g. `san-antonio` instead of `spurs`), using a non-NBA team, or the team slug format differs from what's in the map (case sensitivity).","solutions":["Check the `NBA_TEAMS_ID_MAP` keys in `lib/routes/hupu/consts.ts` for the exact valid slugs.","Use lowercase team nicknames as documented (e.g. `spurs`, `lakers`, `warriors`, `celtics`).","As a maintainer: switch to `InvalidParameterError` and list valid team names in the error message."],"exampleFix":"// before (broken)\n// GET /hupu/news/SanAntonio\n\n// after (correct)\n// GET /hupu/news/spurs","handlingStrategy":"validation","validationCode":"import { NBA_TEAMS_ID_MAP } from './consts';\nfunction isValidTeam(team: string): boolean {\n    return Boolean(NBA_TEAMS_ID_MAP[team]?.teamId);\n}","typeGuard":"function isKnownNbaTeam(team: string): boolean {\n    return Boolean(NBA_TEAMS_ID_MAP[team]?.teamId);\n}","tryCatchPattern":null,"preventionTips":["Use `InvalidParameterError` and list valid team slugs in the error message.","Document that team names should be lowercase nicknames.","Consider adding `parameters.options` listing all valid teams from `NBA_TEAMS_ID_MAP`."],"tags":["parameter-validation","rsshub","bbs"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}