JuliusBrussee/caveman · error
${label}:${lineNo}: "${text}" is not a finite number
Error message
${label}:${lineNo}: "${text}" is not a finite number What it means
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.
Source
Thrown at scripts/generate-agent-catalog.mjs:124
throw new Error(`${label}:${lineNo}: unexpected indent of ${indent} spaces`);
}
return rows;
}
function splitKeyValue(text, label, lineNo) {
const match = /^([A-Za-z_][A-Za-z0-9_]*):(?: (.*))?$/.exec(text);
if (match === null) throw new Error(`${label}:${lineNo}: cannot read "${text}" as a "key: value" pair`);
return { key: match[1], value: match[2] === undefined ? undefined : scalar(match[2], label, lineNo) };
}
function scalar(text, label, lineNo) {
if (text === "") throw new Error(`${label}:${lineNo}: empty value`);
if (text === "null") return null;
if (text === "true") return true;
if (text === "false") return false;
if (/^-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?$/.test(text)) {
const value = Number(text);
if (!Number.isFinite(value)) throw new Error(`${label}:${lineNo}: "${text}" is not a finite number`);
return value;
}
return text;
}
/** Selects the priced, region-agnostic, USD rows the agent catalog can honestly carry. */
export function selectRows(rows, label = CATALOG_LABEL) {
const selected = [];
const skippedByKey = new Map();
const seen = new Set();
const record = (key) => {
let entry = skippedByKey.get(key);
if (entry === undefined) {
entry = { regions: [], reasons: [] };
skippedByKey.set(key, entry);
}
return entry;
};View on GitHub (pinned to 27d5a3981a)
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.
Example fix
# before input_per_million: 1e999 # after input_per_million: 1e-9
Defensive patterns
Strategy: validation
Validate before calling
// Verify every numeric catalog value converts to a finite number.
const isFiniteScalar = (v) => {
if (typeof v === "number") return Number.isFinite(v);
if (typeof v === "string" && /^-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?$/.test(v))
return Number.isFinite(Number(v));
return true;
}; Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Typo in an exponent while hand-editing prices; unit conversion scripts emitting absurd magnitudes; placeholder values pasted from notes.
Related errors
- ${label}: row is missing a string "${field}"
- ${label}: ${key} has no pricing block
- ${label}: ${field} must be a finite non-negative number
- %s: provider, model, and region are required
- %s %s/%s: unsupported currency %q
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/d63934d17f680b09.
Report an issue: GitHub.