{"record":{"id":"dbe91a6b37378d11","repo":"abhigyanpatwari/GitNexus","slug":"gitnexus-rc-filename-prev-and-key-bo","errorCode":null,"errorMessage":"${GITNEXUS_RC_FILENAME}: \"${prev}\" and \"${key}\" both configure the same option; set only one.","messagePattern":"(.+?): \"(.+?)\" and \"(.+?)\" both configure the same option; set only one\\.","errorType":"validation","errorClass":"GitNexusRcError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/analyze-config.ts","lineNumber":354,"sourceCode":"): Partial<AnalyzeOptions> => {\n  const out: Partial<AnalyzeOptions> = {};\n  const setBy = new Map<keyof AnalyzeOptions, string>();\n\n  for (const [key, value] of Object.entries(obj)) {\n    if (allowNestedKey && key === NESTED_KEY) continue; // handled separately\n    // `Object.hasOwn`, not a truthiness check: a plain-object lookup like\n    // `KEY_SPECS[\"__proto__\"]` returns an inherited member (Object.prototype,\n    // truthy) and would slip past `if (!spec)`, hitting the wrong error branch\n    // instead of the documented \"Unknown key\" message (#1996 tri-review P3).\n    if (!Object.hasOwn(KEY_SPECS, key)) {\n      throw new GitNexusRcError(\n        `Unknown key \"${key}\" in ${GITNEXUS_RC_FILENAME}. ${ALLOWED_KEYS_HINT}`,\n      );\n    }\n    const spec = KEY_SPECS[key];\n    const prev = setBy.get(spec.target);\n    if (prev && prev !== key) {\n      throw new GitNexusRcError(\n        `${GITNEXUS_RC_FILENAME}: \"${prev}\" and \"${key}\" both configure the same option; set only one.`,\n      );\n    }\n    setBy.set(spec.target, key);\n    (out as Record<string, unknown>)[spec.target] = normalizeValue(spec.kind, value, key);\n  }\n\n  return out;\n};\n\n/**\n * Locate, read, parse, validate, and normalize `.gitnexusrc` at `repoRoot`.\n *\n * @returns the normalized config defaults, or `undefined` when no file exists\n *          (the normal case). Throws {@link GitNexusRcError} on any problem.\n */\nexport function loadAnalyzeConfig(repoRoot: string): Partial<AnalyzeOptions> | undefined {\n  const filePath = path.join(repoRoot, GITNEXUS_RC_FILENAME);","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/cli/analyze-config.ts#L336-L372","documentation":"Two keys that alias the same AnalyzeOptions target appear at the same config level. Aliases are: `defaultBranch`/`branch`; `skipAgentsMd`/`skipContextFiles`/`skipAiContext`; `stats`/`noStats`. GitNexus rejects the ambiguity rather than guessing which value wins. Note this is per-level: a flat key plus a nested `analyze` key for the same option is allowed (nested wins).","triggerScenarios":"Setting { \"defaultBranch\": \"develop\", \"branch\": \"main\" } or { \"skipContextFiles\": true, \"skipAiContext\": false } at the same level.","commonSituations":"Merging config examples from different documentation eras (legacy `branch` + new `defaultBranch`); both alias spellings present after a refactor; copy-paste accumulation.","solutions":["Keep only one alias per option at each level.","Prefer the canonical name (defaultBranch, skipAgentsMd, stats).","If you need precedence between two spellings, use the nested `analyze` block for the override."],"exampleFix":"// before\n{\"branch\": \"main\", \"defaultBranch\": \"develop\"}\n// after\n{\"defaultBranch\": \"develop\"}","handlingStrategy":"validation","validationCode":"const ALIAS_GROUPS = [\n  ['defaultBranch','branch'],\n  ['skipAgentsMd','skipContextFiles','skipAiContext'],\n  ['stats','noStats'],\n];\nfor (const group of ALIAS_GROUPS) {\n  const present = group.filter((k) => k in cfg);\n  if (present.length > 1) throw new Error('Set only one of: ' + present.join(', '));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer canonical names: defaultBranch, skipAgentsMd, stats.","Use the nested `analyze` block (not a second alias) when you need precedence."],"tags":["config","gitnexusrc","validation","aliases"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}