DIYgod/RSSHub · warning · InvalidParameterError

无效序列号, 请检查你的序列号是否正确.

Error message

无效序列号, 请检查你的序列号是否正确.

What it means

Thrown as InvalidParameterError by the Lenovo driver-download route when the Lenovo support API returns a non-200 statusCode for the given selName (product serial number / machine type). The Chinese message means 'invalid serial number, please check that your serial number is correct'. The route assumes any non-200 means the serial number is wrong.

Source

Thrown at lib/routes/lenovo/drive.tsx:40

    radar: [
        {
            source: ['lenovo.com.cn'],
            target: '/drive/:selName',
        },
    ],
    name: '驱动',
    maintainers: ['cscnk52'],
    handler,
};

export async function handler(ctx) {
    const selName = ctx.req.param('selName');
    const link = `https://newsupport.lenovo.com.cn/api/drive/drive_listnew?searchKey=${selName}`;

    const response = await ofetch(link);

    if (response.statusCode !== 200) {
        throw new InvalidParameterError('无效序列号, 请检查你的序列号是否正确.');
    }

    const driveList = response.data.partList.flatMap((part) => part.drivelist);

    const items: DataItem[] = driveList.map(
        (item) =>
            ({
                title: `${item.DriverName} ${item.Version}`,
                link: `https://newsupport.lenovo.com.cn/driveDownloads_detail.html?driveId=${item.DriverEdtionId}`,
                description: renderToString(<DriveDescription driveName={item.DriverName} driveCode={item.DriverCode} driveVersion={item.Version} downloadFileName={item.FileName} downloadFilePath={item.FilePath} />),
                pubDate: timezone(parseDate(item.CreateTime), 8),
            }) as DataItem
    );

    return {
        title: `${response.data.driverSerious[0].NodeCode} 驱动`,
        item: items,
        language: 'zh-CN',

View on GitHub (pinned to bed535e087)

Solutions

  1. Verify the serial number on the Lenovo support site directly: https://newsupport.lenovo.com.cn/ and search for it manually.
  2. In the route, distinguish 4xx (likely bad input) from 5xx (server error) and throw InvalidParameterError only for 4xx.
  3. Trim whitespace and uppercase the selName before submitting, since Lenovo serials are case-sensitive and whitespace-sensitive.
  4. Include the actual statusCode in the error message for diagnosability.

Example fix

// before
if (response.statusCode !== 200) {
    throw new InvalidParameterError('无效序列号, 请检查你的序列号是否正确.');
}

// after — distinguish bad input from server fault
if (response.statusCode !== 200) {
    if (response.statusCode >= 400 && response.statusCode < 500) {
        throw new InvalidParameterError(`Invalid serial number '${selName}' (status ${response.statusCode}).`);
    }
    throw new Error(`Lenovo API error (status ${response.statusCode}); try again later.`);
}
Defensive patterns

Strategy: validation

Validate before calling

const selName = ctx.req.param('selName').trim().toUpperCase();
if (!/^[A-Z0-9]{4,12}$/.test(selName)) {
    throw new InvalidParameterError(`Serial number '${selName}' does not look valid (expected 4-12 alphanumeric chars).`);
}
// After fetch:
if (response.statusCode !== 200) {
    if (response.statusCode >= 500) throw new Error(`Lenovo API unavailable (status ${response.statusCode})`);
    throw new InvalidParameterError(`Invalid serial number '${selName}' (status ${response.statusCode})`);
}

Try / catch

try {
    const response = await ofetch(link);
    if (response.statusCode !== 200) {
        // distinguish bad input from server fault
    }
} catch (e) {
    throw new Error(`Lenovo drive API unreachable: ${(e as Error).message}`, { cause: e });
}

Prevention

When it happens

Trigger: Submitting a mistyped or invalid Lenovo product serial number (e.g. PF3WRD2G is the example format). Also fires if the Lenovo API is temporarily unavailable (5xx) or rate-limits the request — the route conflates all non-200 responses with 'bad serial number'.

Common situations: User transposes digits in the serial number. User submits a consumer-model code to the business support endpoint or vice versa. Lenovo API has a transient outage and returns 500, but the user sees 'invalid serial number' which is misleading.

Related errors


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