DIYgod/RSSHub · warning

Jiangsu, Cannot find page

Error message

Jiangsu, Cannot find page

What it means

Thrown by the Jiangsu provincial government route helper (deprecated) when category matches no switch case. The default branch only logs and leaves cid as ''; the `if (cid === '')` guard then throws 'Jiangsu, Cannot find page'. Valid cases: executive-meeting, important-news, department, city-county, documentation, policy-interpretation, normative-document, legislative-opinion-collection, opinion-collection, annual-report, information-publicity.

Source

Thrown at lib/routes-deprecated/gov/province/jiangsu/index.js:61

            break;
        case 'opinion-collection':
            cid = 31344;
            uid = 158542;
            break;
        case 'annual-report':
            cid = 31251;
            uid = 300520;
            break;
        case 'information-publicity':
            cid = 31319;
            uid = 158542;
            break;
        default:
            logger.error('URL pattern not matched');
    }

    if (cid === '') {
        throw new Error('Jiangsu, Cannot find page');
    }

    const responseData = await getContent(homePage, cid, uid, TOTAL_PAGE);
    return responseData;
};

View on GitHub (pinned to bed535e087)

Solutions

  1. Use one of the eleven documented categories (e.g. information-publicity, important-news).
  2. Verify the calling route forwards only supported categories to this helper.
  3. Add a switch case with the correct cid/uid pair from the source site if a new category is genuinely needed.

Example fix

// before
switch ('info-publicity')   // no case matches
// after
switch ('information-publicity')
Defensive patterns

Strategy: validation

Validate before calling

const VALID = ['executive-meeting','important-news','department','city-county','documentation','policy-interpretation','normative-document','legislative-opinion-collection','opinion-collection','annual-report','information-publicity'];
if (!VALID.includes(category)) throw new Error(`Invalid Jiangsu category. Valid: ${VALID.join(', ')}`);

Type guard

const isJiangsuCategory = (v: string): v is 'executive-meeting' | 'important-news' | 'department' | 'city-county' | 'documentation' | 'policy-interpretation' | 'normative-document' | 'legislative-opinion-collection' | 'opinion-collection' | 'annual-report' | 'information-publicity' => VALID.includes(v);

Try / catch

try { await getContent(homePage, category); }
catch (e) { if (/Cannot find page/.test(e.message)) return safeEmpty(); else throw e; }

Prevention

When it happens

Trigger: Calling the helper with a category outside the eleven supported cases; cid stays empty and the post-switch check throws.

Common situations: Slug typo, or caller forwarding a category intended for a different province's helper. The empty-string sentinel design means any future case that legitimately needs cid=0 would be misclassified.

Related errors


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