DIYgod/RSSHub · error · InvalidParameterError

未找到 ${placeName} 的疫情数据,请检查输入的省市名称是否正确

Error message

未找到 ${placeName} 的疫情数据,请检查输入的省市名称是否正确

What it means

An `InvalidParameterError` thrown at lib/routes/tencent/news/coronavirus/data.tsx:54 when neither the province nor the city path parameter matches any entry in Tencent's diseaseh5Shelf `areaTree`. Matching is an exact string comparison (`e.name === province`) against Chinese-language names, so any transliteration or spacing difference fails. The data source is Tencent's real-time COVID tracker, which may have been discontinued or frozen.

Source

Thrown at lib/routes/tencent/news/coronavirus/data.tsx:54

    if (!province || province === '中国' || province === '全国') {
        // 没有传参则取全国
        coronavirusData = nationalData;
        placeName = '中国';
    } else {
        // 分省份获取
        coronavirusData = provinceList?.find((e) => e.name === province);
        placeName = province;
        if (city) {
            // 继续获取 区县 数据
            coronavirusData = coronavirusData?.children?.find((e) => e.name === city);
            if (coronavirusData) {
                placeName = `${province}-${city}`;
            }
        }
    }
    if (!coronavirusData) {
        throw new InvalidParameterError(`未找到 ${placeName} 的疫情数据,请检查输入的省市名称是否正确`);
    }
    const todayConfirm = coronavirusData.today?.confirm;
    const totalNowConfirm = coronavirusData.total?.nowConfirm;
    const totalConfirm = coronavirusData.total?.confirm;
    const totalDead = coronavirusData.total?.dead;
    const pubDate = parseDate(coronavirusData.total?.mtime || lastUpdateTime);

    const title = `${placeName} - 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪`;

    const info = {
        title: `${placeName} - 疫情数据`,
        description: renderToString(
            <>
                <p>新增确诊:</p>
                <p>{`+${todayConfirm}`}</p>
                <br />
                <p>现有确诊:</p>
                <p>{totalNowConfirm}</p>

View on GitHub (pinned to bed535e087)

Solutions

  1. Use the exact Chinese names as shown on the Tencent tracker dashboard (news.qq.com/zt2020/page/feiyan.htm), e.g. `/tencent/news/coronavirus/data/湖北/武汉`.
  2. Omit the city parameter to get province-level data: `/tencent/news/coronavirus/data/湖北`.
  3. Omit both province and city to get national data.
  4. If the data source is dead, the route itself needs updating — check whether getData(['diseaseh5Shelf']) still returns a populated areaTree.
Defensive patterns

Strategy: validation

Validate before calling

// validate Chinese province/city names before calling the route
const province = '湖北';
const knownProvinces = ['湖北', '广东', '河南', '浙江', '湖南', '安徽']; // consult Tencent dashboard
if (province && !knownProvinces.includes(province)) {
    console.warn('Province may not match Tencent data; use exact Chinese names');
}

Prevention

When it happens

Trigger: Passing 'Hubei' instead of '湖北'; passing a valid province but a city name that doesn't appear in that province's `children` array; passing a district name in the city slot for a municipality (直辖市的区县); the diseaseh5Shelf API stopped returning data so `provinceList` is undefined.

Common situations: User enters province/city in English or Pinyin; simplified vs. traditional Chinese mismatch; Tencent deprecated the COVID data endpoint so areaTree is empty; user tries a county-level name in the city field.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/c7cf6e0e567ebdda. Report an issue: GitHub.