{"record":{"id":"9352713a608ec8ba","repo":"DIYgod/RSSHub","slug":"invalid-district","errorCode":null,"errorMessage":"Invalid district","messagePattern":"Invalid district","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"error","filePath":"lib/routes/wellcee/rent.tsx","lineNumber":70,"sourceCode":"    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: [],\n            timeTypeIds: [],\n            price: [],\n            tagTypeIds: [],\n            cityId: cityInfo.id,\n            lang: 1,\n            pn: 1,\n        },\n    });","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/wellcee/rent.tsx#L52-L88","documentation":"An `InvalidParameterError` at lib/routes/wellcee/rent.tsx:70 when the optional `:district` path parameter is provided but does not match any `name` in the district list returned by `getDistricts(cityInfo.id)` for the given city. Only evaluated when `district` is non-empty. Districts are Chinese-language names fetched dynamically per-city.","triggerScenarios":"Passing a valid city but a district that doesn't belong to it (e.g. a Beijing district under 上海); passing the English district name; the district was renamed in Wellcee's database; URL-encoding issues with Chinese characters in the path.","commonSituations":"User enters English district name; user mixes up which districts belong to which city; district list API shape changed.","solutions":["Omit the `:district` parameter entirely to get all listings for the city.","Inspect the Wellcee website for the target city to find the exact Chinese district name used internally.","Verify getDistricts() in ./utils still returns the expected `[{ name, id, ... }]` shape."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const districts = await getDistricts(cityInfo.id);\nconst validDistrictNames = districts.map((d) => d.name);\nif (district && !validDistrictNames.includes(district)) {\n    throw new InvalidParameterError(`Invalid district. Supported: ${validDistrictNames.join(', ')}`);\n}","typeGuard":"const isValidWellceeDistrict = (district: string, districts: Array<{ name: string }>): boolean =>\n    districts.some((d) => d.name === district);","tryCatchPattern":null,"preventionTips":["Omit the district parameter if you want all listings for a city.","Use the exact Chinese district name from the Wellcee website filter UI for that city.","Districts are city-specific — a valid district for one city will fail for another."],"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"}