{"record":{"id":"d63934d17f680b09","repo":"JuliusBrussee/caveman","slug":"label-lineno-text-is-not-a-finite-numb","errorCode":null,"errorMessage":"${label}:${lineNo}: \"${text}\" is not a finite number","messagePattern":"(.+?):(.+?): \"(.+?)\" is not a finite number","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/generate-agent-catalog.mjs","lineNumber":124,"sourceCode":"    throw new Error(`${label}:${lineNo}: unexpected indent of ${indent} spaces`);\n  }\n  return rows;\n}\n\nfunction splitKeyValue(text, label, lineNo) {\n  const match = /^([A-Za-z_][A-Za-z0-9_]*):(?: (.*))?$/.exec(text);\n  if (match === null) throw new Error(`${label}:${lineNo}: cannot read \"${text}\" as a \"key: value\" pair`);\n  return { key: match[1], value: match[2] === undefined ? undefined : scalar(match[2], label, lineNo) };\n}\n\nfunction scalar(text, label, lineNo) {\n  if (text === \"\") throw new Error(`${label}:${lineNo}: empty value`);\n  if (text === \"null\") return null;\n  if (text === \"true\") return true;\n  if (text === \"false\") return false;\n  if (/^-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?$/.test(text)) {\n    const value = Number(text);\n    if (!Number.isFinite(value)) throw new Error(`${label}:${lineNo}: \"${text}\" is not a finite number`);\n    return value;\n  }\n  return text;\n}\n\n/** Selects the priced, region-agnostic, USD rows the agent catalog can honestly carry. */\nexport function selectRows(rows, label = CATALOG_LABEL) {\n  const selected = [];\n  const skippedByKey = new Map();\n  const seen = new Set();\n  const record = (key) => {\n    let entry = skippedByKey.get(key);\n    if (entry === undefined) {\n      entry = { regions: [], reasons: [] };\n      skippedByKey.set(key, entry);\n    }\n    return entry;\n  };","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/scripts/generate-agent-catalog.mjs#L106-L142","documentation":"Thrown by scalar() in scripts/generate-agent-catalog.mjs when a value matches the numeric regex (optional minus, digits, optional fraction, optional exponent) but Number(text) is not finite. The only realistic input that passes the regex yet overflows is an extreme exponent such as 1e999, which JavaScript converts to Infinity. The guard keeps infinite prices out of the generated catalog module.","triggerScenarios":"A catalog value like `input_per_million: 1e999` or `-1e999` — syntactically a number per the regex, but Number() yields Infinity/-Infinity, so Number.isFinite(value) is false.","commonSituations":"Typo in an exponent while hand-editing prices; unit conversion scripts emitting absurd magnitudes; placeholder values pasted from notes.","solutions":["Fix the value on the reported line to a plain finite decimal literal (e.g. 0.25 or 3.5e-3).","If the number came from a generator/conversion script, fix its formatting so it emits finite decimals.","Re-run scripts/generate-agent-catalog.mjs to confirm."],"exampleFix":"# before\n  input_per_million: 1e999\n# after\n  input_per_million: 1e-9","handlingStrategy":"validation","validationCode":"// Verify every numeric catalog value converts to a finite number.\nconst isFiniteScalar = (v) => {\n  if (typeof v === \"number\") return Number.isFinite(v);\n  if (typeof v === \"string\" && /^-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?$/.test(v))\n    return Number.isFinite(Number(v));\n  return true;\n};","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer plain decimal literals for prices (0.25, 15) over exponent notation.","If a script generates the YAML, format numbers with toFixed or a bounded exponent."],"tags":["yaml","numbers","catalog","validation"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}