{"record":{"id":"f6b1b170cb1e53c2","repo":"abhigyanpatwari/GitNexus","slug":"source-must-be-a-boolean-true-false","errorCode":null,"errorMessage":"${source} must be a boolean (true/false).","messagePattern":"(.+?) must be a boolean \\(true/false\\)\\.","errorType":"validation","errorClass":"GitNexusRcError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/analyze-config.ts","lineNumber":215,"sourceCode":" * Best-effort validation for an auto-detected branch (from git). Never throws —\n * returns `undefined` for anything unusable so the resolver falls back to the\n * next precedence tier.\n */\nexport function sanitizeDetectedBranch(value: string | null | undefined): string | undefined {\n  if (!value) return undefined;\n  try {\n    return validateBranchName(value, 'detected branch');\n  } catch {\n    return undefined;\n  }\n}\n\nconst normalizeValue = (kind: ValueKind, value: unknown, key: string): unknown => {\n  const source = `${GITNEXUS_RC_FILENAME} \"${key}\"`;\n  switch (kind) {\n    case 'boolean':\n      if (typeof value !== 'boolean') {\n        throw new GitNexusRcError(`${source} must be a boolean (true/false).`);\n      }\n      return value;\n    case 'boolean-negate':\n      if (typeof value !== 'boolean') {\n        throw new GitNexusRcError(`${source} must be a boolean (true/false).`);\n      }\n      return !value;\n    case 'branch':\n      if (typeof value !== 'string') {\n        throw new GitNexusRcError(`${source} must be a string branch name.`);\n      }\n      return validateBranchName(value, source);\n    case 'string': {\n      if (typeof value !== 'string') {\n        throw new GitNexusRcError(`${source} must be a string.`);\n      }\n      const trimmed = value.trim();\n      if (!trimmed) {","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/cli/analyze-config.ts#L197-L233","documentation":"Thrown by normalizeValue() in the 'boolean' case (for keys like skipAgentsMd, skipSkills, pdg, indexOnly, stats, dropEmbeddings, allowDuplicateName) when the .gitnexusrc value is not a JSON boolean. The strict type check ensures a config typo (e.g. a string \"true\") cannot silently no-op a flag that controls analysis behavior.","triggerScenarios":"Setting a boolean key to a string (\"skipSkills\": \"true\"), a number (\"stats\": 1), or null in .gitnexusrc.","commonSituations":"Writing config by hand with quoted booleans (common YAML-ism leaked into JSON); a generated config that serialized a boolean as a string; confusing the JSON value type with the CLI flag form.","solutions":["Use an unquoted JSON boolean: true or false (no quotes, no 1/0).","Run the file through `node -e 'JSON.parse(fs.readFileSync(\".gitnexusrc\"))'` to confirm it parses.","If you need shell-style truthiness, that is not supported — write a real boolean."],"exampleFix":"// before\n{ \"skipSkills\": \"true\" }\n\n// after\n{ \"skipSkills\": true }","handlingStrategy":"type-guard","validationCode":"function assertConfigBoolean(value: unknown, key: string): void {\n  if (typeof value !== 'boolean') {\n    throw new Error(`${key} must be a boolean (true/false), got ${typeof value}`);\n  }\n}","typeGuard":"function isConfigBoolean(value: unknown): value is boolean {\n  return typeof value === 'boolean';\n}","tryCatchPattern":null,"preventionTips":["Write JSON booleans unquoted: true / false, never \"true\" or 1.","Run `node -e 'JSON.parse(fs.readFileSync(\".gitnexusrc\"))'` to confirm parsing.","Remember that JSON has no bare yes/no or 1/0 — only true/false."],"tags":["validation","config","typescript","json"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}