jackwener/OpenCLI · error · ArgumentError
'${rawInput}' does not look like a dongchedi series id (a nu
Error message
'${rawInput}' does not look like a dongchedi series id (a number, or a /auto/series/<id> URL) What it means
normalizeSeriesId accepts only a bare digit string or a dongchedi /auto/series/<id> URL. It throws ArgumentError when the input is non-empty but matches neither pattern, so the library cannot extract a numeric series id from it.
Source
Thrown at clis/dongchedi/utils.js:154
}
/** Rescale a Dongchedi x100 score int (422) to a /5 float (4.22). */
export function parseScore(raw) {
const n = Number(raw);
if (!Number.isFinite(n) || n <= 0) return null;
return Number((n / 100).toFixed(2));
}
/**
* Normalize a series id argument: a bare number, or a
* `https://www.dongchedi.com/auto/series/<id>` URL.
*/
export function normalizeSeriesId(rawInput) {
const raw = String(rawInput || '').trim();
if (!raw) throw new ArgumentError('series_id must be a non-empty value');
const m = raw.match(/series\/(\d+)/) || raw.match(/^(\d+)$/);
if (!m) {
throw new ArgumentError(
`'${rawInput}' does not look like a dongchedi series id (a number, or a /auto/series/<id> URL)`,
);
}
return m[1];
}
/** Validate an integer limit in [1, max]. */
export function requireLimit(value, def, max) {
const raw = value == null || value === '' ? def : value;
const n = typeof raw === 'number' ? raw : Number(String(raw).trim());
if (!Number.isInteger(n) || n < 1 || n > max) {
throw new ArgumentError(`limit must be an integer between 1 and ${max}`);
}
return n;
}
/** Collapse whitespace and trim; returns '' for nullish. */
export function clean(s) {View on GitHub (pinned to 49907e53dc)
Solutions
- Pass the full URL form: https://www.dongchedi.com/auto/series/4694
- Or pass just the numeric id string, e.g. seriesId('4694')
- Open the dongchedi series page in a browser and copy the number after /auto/series/ — note spec ids (/auto/spec/) are different and will not match
Example fix
// before
await seriesId('https://www.dongchedi.com/auto/spec/7005');
// after
await seriesId('https://www.dongchedi.com/auto/series/4694'); Defensive patterns
Strategy: validation
Validate before calling
const raw = String(input ?? '').trim();
const m = raw.match(/series\/(\d+)/) || raw.match(/^(\d+)$/);
if (!m) throw new Error(`'${input}' is not a dongchedi series id (number or /auto/series/<id> URL)`); Type guard
function looksLikeSeriesId(v) { const s = String(v ?? '').trim(); return /^\d+$/.test(s) || /series\/\d+/.test(s); } Try / catch
try { await seriesId(input); } catch (e) { if (e.name === 'ArgumentError') { console.error('Expected a number or https://www.dongchedi.com/auto/series/<id>'); } else throw e; } Prevention
- Store the numeric id, not the whole URL, in config/scripts
- Extract ids with a regex when accepting pasted URLs
- Do not confuse /auto/spec/ ids with /auto/series/ ids
When it happens
Trigger: Passing values like 'series/4694' (no domain prefix), a full dongchedi URL with a different path shape (e.g. /auto/spec/<id>), a model name string, an id with letters or whitespace inside, or a decimal like '4694.5'.
Common situations: Copying a partial URL fragment instead of the full URL; pasting a car model name instead of the numeric id; confusion with spec (车型) ids from /auto/spec/ pages which use a different id space.
Related errors
- series_id must be a non-empty value
- Invalid Douban subject ID: ${subjectId}
- Unknown 12306 station telecode "${trimmed}"
- Unknown 12306 station "${trimmed}"
- date must be YYYY-MM-DD, got "${value}"
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1ddd33bd73ae923f.
Report an issue: GitHub.