abhigyanpatwari/GitNexus · error · GitNexusRcError
must be a finite number.
Error message
${source} must be a finite number. What it means
For numeric-string options (maxFileSize, workerTimeout, walCheckpointThreshold, workers, embeddingThreads, embeddingBatchSize, embeddingSubBatchSize) a JSON number is accepted only if finite. NaN, Infinity, or -Infinity — which cannot be serialized in strict JSON but arrive via exponents like 1e999 that JSON.parse maps to Infinity, or via programmatic construction — are rejected.
Solutions
- Use a plain finite number: {"workers": 8} or a modest exponent like 1e3
- If generating the rc file from code, guard with Number.isFinite before serializing
- Check downstream CLI ranges — the value is normalized to a string and range-checked per flag later, so pick values within the flag's documented range
Example fix
// before (.gitnexusrc)
{"workers": 1e999}
// after
{"workers": 8} Defensive patterns
Strategy: validation
Validate before calling
const NUMERIC_KEYS = ['maxFileSize','workerTimeout','walCheckpointThreshold','workers','embeddingThreads','embeddingBatchSize','embeddingSubBatchSize'];
for (const k of NUMERIC_KEYS) {
const v = rc[k];
if (typeof v === 'number' && !Number.isFinite(v)) throw new Error(`${k} must be finite`);
} Type guard
const isFiniteNumberOrNumericString = (v: unknown): v is number | string => (typeof v === 'number' && Number.isFinite(v)) || (typeof v === 'string' && v.trim() !== '');
Try / catch
catch (err) {
if (err instanceof GitNexusRcError && err.message.includes('finite number')) {
// check for 1e999-style exponents in the rc file
}
} Prevention
- Avoid exponent notation for these keys; write plain integers
- Guard generators with Number.isFinite before writing values
When it happens
Trigger: {"workers": 1e999} in .gitnexusrc (parses to Infinity); passing NaN/Infinity programmatically into the config loader; anything where Number.isFinite(value) is false in the number branch of the 'numeric-string' case.
Common situations: Using exponent notation with a huge magnitude; a generator writing a computed number that overflows to Infinity; copying values from scientific notation output.
Related errors
- must contain a JSON object.
- " " must be a JSON object.
- : " " and " " both configure the same option; set only one.
- entries must all be strings.
- entries must not be empty.
AI-assisted analysis of abhigyanpatwari/GitNexus@ac9a4e9abd (2026-08-20).
Data as JSON: /api/errors/a65a68ac155d9200.
Report an issue: GitHub.
Appendix: source
Thrown at gitnexus/src/cli/analyze-config.ts:283
);
}
names.push(trimmed);
}
if (names.length === 0) {
throw new GitNexusRcError(`${source} must list at least one string.`);
}
// De-duplicate and cap to a sane bound so a pathological config cannot
// blow up the consumer scan's alternation.
return Array.from(new Set(names)).slice(0, 100);
}
case 'numeric-string': {
// Mirror Commander's contract: these options reach the existing CLI
// validation as strings. Accept a JSON number or a string; normalize to a
// string and let the downstream per-flag validation enforce ranges so the
// error messages stay in one place.
if (typeof value === 'number') {
if (!Number.isFinite(value)) {
throw new GitNexusRcError(`${source} must be a finite number.`);
}
return String(value);
}
if (typeof value === 'string') {
const trimmed = value.trim();
if (!trimmed) {
throw new GitNexusRcError(`${source} must not be empty.`);
}
return trimmed;
}
throw new GitNexusRcError(`${source} must be a number or numeric string.`);
}
case 'embeddings': {
// Mirror `--embeddings [limit]`: boolean toggles, a non-negative integer
// sets the node cap (normalized to a string, as Commander would supply).
if (typeof value === 'boolean') return value;
if (typeof value === 'number') {
if (!Number.isInteger(value) || value < 0) {View on GitHub (pinned to ac9a4e9abd)