{"record":{"id":"0056af6e86231619","repo":"jackwener/OpenCLI","slug":"label-did-not-include-a-stable-numeric-id-0056af","errorCode":null,"errorMessage":"${label} did not include a stable numeric id.","messagePattern":"(.+?) did not include a stable numeric id\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/dongchedi/utils.js","lineNumber":125,"sourceCode":"\nexport function assertPlainObject(value, label) {\n    if (!value || typeof value !== 'object' || Array.isArray(value)) {\n        throw new CommandExecutionError(`${label} returned an unexpected payload shape; expected an object.`);\n    }\n    return value;\n}\n\nexport function requireArray(value, label) {\n    if (!Array.isArray(value)) {\n        throw new CommandExecutionError(`${label} returned an unexpected payload shape; expected an array.`);\n    }\n    return value;\n}\n\nexport function requireStableId(value, label) {\n    const id = String(value ?? '').trim();\n    if (!/^\\d+$/.test(id) || id === '0') {\n        throw new CommandExecutionError(`${label} did not include a stable numeric id.`);\n    }\n    return id;\n}\n\nexport function requireText(value, label) {\n    const text = clean(value);\n    if (!text) {\n        throw new CommandExecutionError(`${label} did not include a stable text value.`);\n    }\n    return text;\n}\n\n/** Rescale a Dongchedi x100 score int (422) to a /5 float (4.22). */\nexport function parseScore(raw) {\n    const n = Number(raw);\n    if (!Number.isFinite(n) || n <= 0) return null;\n    return Number((n / 100).toFixed(2));\n}","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dongchedi/utils.js#L107-L143","documentation":"A CommandExecutionError thrown by requireStableId (clis/dongchedi/utils.js:125), called by parseModels and other parsers (gid/seriesId paths). It fires when an entity that must carry a stable numeric id (a non-zero digit-only string) yields an empty, non-numeric, or '0' value. The library requires stable ids so output rows can be re-fed into later commands (specs/models/score).","triggerScenarios":"Parsing models or series entries whose `car_id`/`series_id` field is missing, null, a temporary/internal placeholder like 0, or a string with non-digit characters after a Dongchedi schema change.","commonSituations":"Newly published or pre-release car entries that have no assigned id yet; scraping after a schema rename (e.g. id moved to a different key so the old key reads undefined); list items rendered as ad/promo cards without real ids.","solutions":["Inspect the live pageProps entry to find where the numeric id now lives and update the parser's key path.","Filter out list entries without a real id (ads, placeholders, pre-release items) before parsing instead of letting the guard throw.","Verify the item exists on dongchedi.com in a browser — placeholder '0' ids indicate the entry is not a real entity.","Catch CommandExecutionError and skip the offending row, logging which label lacked the id."],"exampleFix":"// before\nconst id = requireStableId(model.car_id, 'model'); // throws on placeholder 0\n// after\nif (!model.car_id || String(model.car_id) === '0') continue; // skip non-real entries\nconst id = requireStableId(model.car_id, 'model');","handlingStrategy":"validation","validationCode":"function hasStableId(entry) {\n  const id = String(entry?.car_id ?? '').trim();\n  return /^\\d+$/.test(id) && id !== '0';\n}","typeGuard":null,"tryCatchPattern":"try {\n  const id = requireStableId(model.car_id, 'model');\n} catch (err) {\n  if (err instanceof CommandExecutionError && /stable numeric id/.test(err.message)) {\n    skipRow(model, 'no stable id'); // filter placeholders instead of crashing\n  } else throw err;\n}","preventionTips":["Filter list entries lacking a real id (ads, pre-release items) before parsing.","Re-check parser key paths when ids come back undefined after a site update.","Confirm '0' ids are placeholders, not real entities, and skip them.","Cross-verify unfamiliar ids against the live site before reuse."],"tags":["schema-validation","missing-id","parsing","dongchedi"],"backgroundTag":"missing-required-identifier","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}