{"record":{"id":"a65a68ac155d9200","repo":"abhigyanpatwari/GitNexus","slug":"source-must-be-a-finite-number","errorCode":null,"errorMessage":"${source} must be a finite number.","messagePattern":"(.+?) must be a finite number\\.","errorType":"validation","errorClass":"GitNexusRcError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/analyze-config.ts","lineNumber":283,"sourceCode":"          );\n        }\n        names.push(trimmed);\n      }\n      if (names.length === 0) {\n        throw new GitNexusRcError(`${source} must list at least one string.`);\n      }\n      // De-duplicate and cap to a sane bound so a pathological config cannot\n      // blow up the consumer scan's alternation.\n      return Array.from(new Set(names)).slice(0, 100);\n    }\n    case 'numeric-string': {\n      // Mirror Commander's contract: these options reach the existing CLI\n      // validation as strings. Accept a JSON number or a string; normalize to a\n      // string and let the downstream per-flag validation enforce ranges so the\n      // error messages stay in one place.\n      if (typeof value === 'number') {\n        if (!Number.isFinite(value)) {\n          throw new GitNexusRcError(`${source} must be a finite number.`);\n        }\n        return String(value);\n      }\n      if (typeof value === 'string') {\n        const trimmed = value.trim();\n        if (!trimmed) {\n          throw new GitNexusRcError(`${source} must not be empty.`);\n        }\n        return trimmed;\n      }\n      throw new GitNexusRcError(`${source} must be a number or numeric string.`);\n    }\n    case 'embeddings': {\n      // Mirror `--embeddings [limit]`: boolean toggles, a non-negative integer\n      // sets the node cap (normalized to a string, as Commander would supply).\n      if (typeof value === 'boolean') return value;\n      if (typeof value === 'number') {\n        if (!Number.isInteger(value) || value < 0) {","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/cli/analyze-config.ts#L265-L301","documentation":"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.","triggerScenarios":"{\"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.","commonSituations":"Using exponent notation with a huge magnitude; a generator writing a computed number that overflows to Infinity; copying values from scientific notation output.","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"],"exampleFix":"// before (.gitnexusrc)\n{\"workers\": 1e999}\n// after\n{\"workers\": 8}","handlingStrategy":"validation","validationCode":"const NUMERIC_KEYS = ['maxFileSize','workerTimeout','walCheckpointThreshold','workers','embeddingThreads','embeddingBatchSize','embeddingSubBatchSize'];\nfor (const k of NUMERIC_KEYS) {\n  const v = rc[k];\n  if (typeof v === 'number' && !Number.isFinite(v)) throw new Error(`${k} must be finite`);\n}","typeGuard":"const isFiniteNumberOrNumericString = (v: unknown): v is number | string =>\n  (typeof v === 'number' && Number.isFinite(v)) ||\n  (typeof v === 'string' && v.trim() !== '');","tryCatchPattern":"catch (err) {\n  if (err instanceof GitNexusRcError && err.message.includes('finite number')) {\n    // check for 1e999-style exponents in the rc file\n  }\n}","preventionTips":["Avoid exponent notation for these keys; write plain integers","Guard generators with Number.isFinite before writing values"],"tags":["config","validation","numbers","gitnexusrc"],"backgroundTag":"non-finite-number","analyzedSha":"ac9a4e9abd8fd3058c070b72c23402a4f887929a","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}