{"record":{"id":"d7df10555dfb5f01","repo":"abhigyanpatwari/GitNexus","slug":"source-must-be-true-false-or-a-non-negative-int","errorCode":null,"errorMessage":"${source} must be true/false or a non-negative integer (node cap; 0 disables the cap).","messagePattern":"(.+?) must be true/false 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":312,"sourceCode":"        }\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:\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","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/cli/analyze-config.ts#L294-L330","documentation":"The `embeddings` config key was set to a JSON number that is not a non-negative integer — negative, fractional, NaN, or non-finite. This mirrors the `--embeddings [limit]` CLI flag: a boolean toggles embeddings, a non-negative integer sets the node cap (0 disables the cap).","triggerScenarios":"Setting { \"embeddings\": -1 }, { \"embeddings\": 2.5 }, or { \"embeddings\": 1.1 } in `.gitnexusrc`.","commonSituations":"Assuming 0/1 are on/off (they are not — 0 disables the cap, 1 caps at one node); passing a fractional limit; using a negative to mean 'disable' instead of false.","solutions":["Use a boolean (true/false) to toggle embeddings on/off.","Use a non-negative integer node cap; 0 disables the cap.","Remove the key to accept the default behavior."],"exampleFix":"// before\n\"embeddings\": 2.5\n// after\n\"embeddings\": 100   — or —   \"embeddings\": true","handlingStrategy":"validation","validationCode":"const v = cfg.embeddings;\nif (typeof v === 'number' && (!Number.isInteger(v) || v < 0)) {\n  throw new Error('embeddings must be a non-negative integer');\n}","typeGuard":"const isEmbeddingsNumber = (v) =>\n  typeof v === 'boolean' || (typeof v === 'number' && Number.isInteger(v) && v >= 0);","tryCatchPattern":null,"preventionTips":["Remember 0 disables the cap — it is not an on/off toggle.","Use a boolean for on/off, an integer for a node cap."],"tags":["config","gitnexusrc","validation","embeddings"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}