{"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":294,"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":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/cli/analyze-config.ts#L276-L312","documentation":"Numeric-string options accept exactly a JSON number or a string; any other JSON type (boolean, null, object, array) reaches the fall-through throw at the end of the 'numeric-string' case. The message names the key (${source}) so you know which option has the wrong type.","triggerScenarios":"{\"workers\": true}, {\"maxFileSize\": null}, {\"embeddingBatchSize\": [8]}, or {\"workerTimeout\": {\"value\": 30}} in .gitnexusrc; also applies inside the nested \"analyze\" block.","commonSituations":"Assuming numeric flags accept booleans (\"workers\": true meaning 'auto'); nesting values an extra level; YAML-to-JSON conversion producing a nested map where a scalar was expected.","solutions":["Replace the value with a number or numeric string: {\"workers\": 8}","Check the message's key name to find the exact offending option","Validate .gitnexusrc against the documented schema (number or string for these seven keys) before running analyze"],"exampleFix":"// before (.gitnexusrc)\n{\"workers\": {\"value\": 8}}\n// after\n{\"workers\": 8}","handlingStrategy":"type-guard","validationCode":"for (const k of NUMERIC_KEYS) {\n  const t = typeof rc[k];\n  if (rc[k] !== undefined && t !== 'number' && t !== 'string') {\n    throw new Error(`${k} must be a number or numeric string, got ${t}`);\n  }\n}","typeGuard":"const isNumericOptionValue = (v: unknown): v is number | string =>\n  typeof v === 'number' || typeof v === 'string';","tryCatchPattern":"catch (err) {\n  if (err instanceof GitNexusRcError && err.message.includes('number or numeric string')) {\n    // the key name in the message is the one with a boolean/null/object/array value\n  }\n}","preventionTips":["Numeric options never accept booleans or nested objects in JSON","After YAML->JSON conversion, re-check scalar types"],"tags":["config","validation","gitnexusrc"],"backgroundTag":"config-type-mismatch","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"}