{"record":{"id":"88a90b65631558a4","repo":"abhigyanpatwari/GitNexus","slug":"source-must-be-a-boolean-or-a-non-negative-inte","errorCode":null,"errorMessage":"${source} must be a boolean or a non-negative integer (node cap; 0 disables the cap).","messagePattern":"(.+?) must be a boolean or a non-negative integer \\(node cap; 0 disables the cap\\)\\.","errorType":"validation","errorClass":"GitNexusRcError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/analyze-config.ts","lineNumber":308,"sourceCode":"          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:\n      // Exhaustive — kept for forward-compat if a new kind is added.\n      throw new GitNexusRcError(`${source}: unsupported config value kind.`);\n  }\n};\n\n/**\n * Normalize one level (flat top-level or the nested `analyze` block) into a\n * partial `AnalyzeOptions`. Rejects unknown keys and two aliases that configure\n * the same option at the same level.\n */\nconst normalizeLevel = (\n  obj: Record<string, unknown>,\n  { allowNestedKey }: { allowNestedKey: boolean },\n): Partial<AnalyzeOptions> => {","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/cli/analyze-config.ts#L290-L326","documentation":"Terminal branch of the 'embeddings' validator: the value is neither boolean nor number, so it cannot mirror `--embeddings [limit]`. Strings like \"yes\"/\"all\" are not accepted in the rc file even though some CLIs tolerate them.","triggerScenarios":"{\"embeddings\": \"true\"}, {\"embeddings\": \"5000\"}, {\"embeddings\": null}, or {\"embeddings\": []} in .gitnexusrc; typeof value is neither 'boolean' nor 'number' at analyze-config.ts:318.","commonSituations":"Quoting a boolean out of caution (\"true\" instead of true); copying a string limit from a shell snippet into JSON; YAML-style 'on'/'off' values.","solutions":["Use the unquoted boolean true/false, or a bare non-negative integer: {\"embeddings\": true}","Remove quotes around numeric caps in JSON","Prefer the nested \"analyze\" block only after the value shape is correct — quoting rules are the same"],"exampleFix":"// before (.gitnexusrc)\n{\"embeddings\": \"true\"}\n// after\n{\"embeddings\": true}","handlingStrategy":"type-guard","validationCode":"if (rc.embeddings !== undefined && !['boolean', 'number'].includes(typeof rc.embeddings)) {\n  throw new Error(`embeddings must be boolean or number, got ${typeof rc.embeddings}`);\n}","typeGuard":"const isEmbeddingsConfig = (v: unknown): v is boolean | number =>\n  typeof v === 'boolean' || typeof v === 'number';","tryCatchPattern":"catch (err) {\n  if (err instanceof GitNexusRcError && err.message.startsWith('embeddings')) {\n    // unquote \"true\"/\"5000\" in the rc file\n  }\n}","preventionTips":["JSON booleans and numbers are never quoted","Write {\"embeddings\": true} or {\"embeddings\": 5000}, not string forms"],"tags":["config","validation","embeddings","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"}