{"record":{"id":"b9cd3b29a0e9f1ae","repo":"abhigyanpatwari/GitNexus","slug":"source-branch-name-must-not-contain-a-backtick","errorCode":null,"errorMessage":"${source}: branch name must not contain a backtick (it would break the generated Markdown).","messagePattern":"(.+?): branch name must not contain a backtick \\(it would break the generated Markdown\\)\\.","errorType":"validation","errorClass":"GitNexusRcError","httpStatus":null,"severity":"warning","filePath":"gitnexus/src/cli/analyze-config.ts","lineNumber":194,"sourceCode":"  if (/[~^:?*[\\\\]/.test(trimmed)) {\n    throw new GitNexusRcError(\n      `${source}: branch name contains characters not allowed in a git ref (~ ^ : ? * [ \\\\).`,\n    );\n  }\n  if (trimmed.startsWith('-')) {\n    throw new GitNexusRcError(`${source}: branch name must not start with \"-\".`);\n  }\n  if (trimmed.includes('..')) {\n    throw new GitNexusRcError(`${source}: branch name must not contain \"..\".`);\n  }\n  // Git permits a backtick in a ref, but the branch is embedded inside a\n  // Markdown inline-code span in the generated AGENTS.md/CLAUDE.md regression\n  // example, where a backtick would close the span early and let the rest of\n  // the template render as instruction text. Reject it at this single\n  // chokepoint so all three tiers (CLI flag, .gitnexusrc, auto-detect via\n  // sanitizeDetectedBranch) are covered (#1996 tri-review P1).\n  if (trimmed.includes('`')) {\n    throw new GitNexusRcError(\n      `${source}: branch name must not contain a backtick (it would break the generated Markdown).`,\n    );\n  }\n  return trimmed;\n}\n\n/**\n * 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  }","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/cli/analyze-config.ts#L176-L212","documentation":"GITNEXUS_WAL_CHECKPOINT_THRESHOLD was set to a non-empty value that parseWalCheckpointThreshold rejects (must be an integer >= -1; -1 disables auto-checkpointing). The env path stays soft — GitNexus warns and falls back to the 64 MiB default — to preserve 'set once in your shell' ergonomics across mixed-version invocations, while the equivalent CLI flag --wal-checkpoint-threshold hard-errors on the same input.","triggerScenarios":"Number(raw) is NaN, fractional, or < -1 for a non-empty trimmed value — e.g. GITNEXUS_WAL_CHECKPOINT_THRESHOLD=\"64MB\", \"0.5\", \"-2\", or \"64_000_000\".","commonSituations":"Writing a byte value with a unit suffix; copying a CLI-flag-style value into an env var; shell quoting/whitespace mistakes; scripts generated for a different tool version expecting a different format.","solutions":["Set a plain integer of bytes: GITNEXUS_WAL_CHECKPOINT_THRESHOLD=134217728 (128 MiB)","Use -1 only to disable auto-checkpointing","Drop the var to accept the 64 MiB default","Prefer the CLI flag --wal-checkpoint-threshold when you want invalid input to fail loudly"],"exampleFix":"# before\nexport GITNEXUS_WAL_CHECKPOINT_THRESHOLD=64MB   # unparseable -> silent 64 MiB default\n\n# after\nexport GITNEXUS_WAL_CHECKPOINT_THRESHOLD=134217728   # plain integer bytes (128 MiB)","handlingStrategy":"validation","validationCode":"// validate before the process starts using it\nconst raw = process.env.GITNEXUS_WAL_CHECKPOINT_THRESHOLD;\nif (raw !== undefined && raw.trim() !== '') {\n  const n = Number(raw);\n  if (!Number.isInteger(n) || n < -1) {\n    throw new Error(\n      `GITNEXUS_WAL_CHECKPOINT_THRESHOLD must be an integer >= -1 (bytes; -1 disables), got: ${raw}`,\n    );\n  }\n}","typeGuard":"const isValidWalThreshold = (raw: string | undefined): boolean => {\n  if (raw === undefined || raw.trim() === '') return true;\n  const n = Number(raw);\n  return Number.isInteger(n) && n >= -1;\n};","tryCatchPattern":null,"preventionTips":["Write byte values as plain integers in env vars — never unit suffixes","Use the CLI flag when you want malformed values to fail loudly instead of soft-falling-back","Smoke-test env templates once at deploy time, not per-run"],"tags":["env-var","wal","configuration"],"backgroundTag":"invalid-env-var-value","analyzedSha":"52924ef12c2290ceee4612526a828ec4cdf2047f","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}