{"record":{"id":"b42045b90a7cfc0a","repo":"DIYgod/RSSHub","slug":"invalid-city-b42045","errorCode":null,"errorMessage":"Invalid city","messagePattern":"Invalid city","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/wellcee/rent.tsx","lineNumber":62,"sourceCode":"    path: '/rent/:city/:district?',\n    example: '/wellcee/rent/北京',\n    parameters: {\n        city: '城市',\n        district: '地区',\n    },\n    name: '租房信息',\n    maintainers: ['TonyRL'],\n    handler,\n    url: 'www.wellcee.com',\n    description: '支持的城市可以通过 [/wellcee/support-city](https://rsshub.app/wellcee/support-city) 获取',\n};\n\nasync function handler(ctx: Context) {\n    const { city, district = '' } = ctx.req.param();\n    const citys = await getCitys();\n    const cityInfo = citys.find((item) => item.chCityName === city);\n    if (!cityInfo) {\n        throw new InvalidParameterError('Invalid city');\n    }\n\n    let districtInfo: District | undefined;\n    if (district) {\n        const districts = await getDistricts(cityInfo.id);\n        const d = districts.find((item) => item.name === district);\n        if (!d) {\n            throw new InvalidParameterError('Invalid district');\n        }\n        districtInfo = d;\n    }\n\n    const response = await ofetch(`${baseUrl}/api/house/filter`, {\n        method: 'POST',\n        body: {\n            districtIds: districtInfo?.id ? [districtInfo.id] : [],\n            subways: [],\n            rentTypeIds: [],","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/wellcee/rent.tsx#L44-L80","documentation":"An `InvalidParameterError` at lib/routes/wellcee/rent.tsx:62 when the `:city` path parameter does not match any `chCityName` in the list fetched by `getCitys()`. Wellcee's city list contains Chinese-language city names (e.g. 北京, 上海), so the match is exact string equality against Chinese names. The supported set is discoverable via the `/wellcee/support-city` route.","triggerScenarios":"Passing 'Beijing' instead of '北京'; passing a city Wellcee does not operate in; trailing whitespace or URL-encoding in the city parameter; the getCitys() API changed and returns an unexpected shape so the find always fails.","commonSituations":"User enters the English city name; user guesses a city not in Wellcee's coverage; the support-city list changed.","solutions":["Call the `/wellcee/support-city` route first to see the exact supported Chinese city names.","Use the exact `chCityName` value (Chinese characters) as the `:city` path segment.","If no cities match at all, check whether the getCitys() utility in ./utils still hits a valid Wellcee API endpoint."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const citys = await getCitys();\nconst validCityNames = citys.map((c) => c.chCityName);\nif (!validCityNames.includes(city)) {\n    throw new InvalidParameterError(`Invalid city. Supported: ${validCityNames.join(', ')}`);\n}","typeGuard":"const isValidWellceeCity = (city: string, citys: Array<{ chCityName: string }>): boolean =>\n    citys.some((c) => c.chCityName === city);","tryCatchPattern":null,"preventionTips":["Always use the exact Chinese city name from the /wellcee/support-city route.","Do not use English city names or Pinyin.","Check for trailing whitespace or URL-encoding when passing Chinese characters in the path."],"tags":["validation","parameters","chinese","wellcee"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}