abhigyanpatwari/GitNexus · error · GitNexusRcError

${source} must be a finite number.

Error message

${source} must be a finite number.

What it means

A `numeric-string` config key (maxFileSize, workerTimeout, walCheckpointThreshold, workers, embeddingThreads, embeddingBatchSize, embeddingSubBatchSize) received a JSON number that is NaN, Infinity, or -Infinity. These keys forward to Commander's per-flag range validation as strings, so the value must be a finite number before normalization.

Source

Thrown at gitnexus/src/cli/analyze-config.ts:293

          );
        }
        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 d540b00184)

Solutions

  1. Replace the value with a concrete finite integer, e.g. "workers": 8.
  2. Pass the value as a numeric string instead, e.g. "workers": "8".
  3. Remove the key to accept the built-in default.

Example fix

// before
"workers": Infinity
// 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 = cfg[k];
  if (typeof v === 'number' && !Number.isFinite(v)) {
    throw new Error(k + ' must be a finite number');
  }
}

Type guard

const isFiniteNumberOrNumericString = (v) =>
  (typeof v === 'number' && Number.isFinite(v)) || (typeof v === 'string' && v.trim().length > 0);

Prevention

When it happens

Trigger: A `.gitnexusrc` value that decodes to a non-finite number, e.g. `1e999` (overflows to Infinity in some lenient parsers) or a hand-authored `Infinity` token accepted by a non-strict JSON reader.

Common situations: Editing `.gitnexusrc` with a lenient parser that accepts `Infinity`; copy-paste from documentation or a JS source where `Infinity` is valid; generated config from a tool that emits sentinel values.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/a65a68ac155d9200. Report an issue: GitHub.