{"record":{"id":"8289be324094a7fa","repo":"abhigyanpatwari/GitNexus","slug":"source-must-be-a-number-or-numeric-string","errorCode":null,"errorMessage":"${source} must be a number or numeric string.","messagePattern":"(.+?) must be a number or numeric string\\.","errorType":"validation","errorClass":"GitNexusRcError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/analyze-config.ts","lineNumber":304,"sourceCode":"    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) {\n          throw new GitNexusRcError(\n            `${source} must be true/false or a non-negative integer (node cap; 0 disables the cap).`,\n          );\n        }\n        return String(value);\n      }\n      throw new GitNexusRcError(\n        `${source} must be a boolean or a non-negative integer (node cap; 0 disables the cap).`,\n      );\n    }\n    default:","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/cli/analyze-config.ts#L286-L322","documentation":"A `numeric-string` config key got a value whose JSON type is neither number nor string — e.g. a boolean, null, object, or array. The normalizer only accepts JSON numbers and numeric strings (which it forwards to the downstream per-flag range checks).","triggerScenarios":"Setting { \"workers\": true }, { \"maxFileSize\": null }, or { \"embeddingThreads\": {} } in `.gitnexusrc`.","commonSituations":"Mistaking a numeric knob for a boolean toggle (e.g. workers: true); setting a value to null intending to clear it; misreading the schema and nesting an object.","solutions":["Use a JSON number or a numeric string for the key.","Remove the key if you do not intend to set it."],"exampleFix":"// before\n\"workers\": true\n// after\n\"workers\": 8","handlingStrategy":"type-guard","validationCode":"for (const k of ['maxFileSize','workerTimeout','walCheckpointThreshold','workers','embeddingThreads','embeddingBatchSize','embeddingSubBatchSize']) {\n  const v = cfg[k];\n  if (v !== undefined && typeof v !== 'number' && typeof v !== 'string') {\n    throw new Error(k + ' must be a number or numeric string');\n  }\n}","typeGuard":"const isNumericStringInput = (v) =>\n  v === undefined || typeof v === 'number' || typeof v === 'string';","tryCatchPattern":null,"preventionTips":["Do not set numeric keys to booleans, null, objects, or arrays.","Provide a JSON schema to your editor so invalid types are flagged."],"tags":["config","gitnexusrc","validation","numeric"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}