abhigyanpatwari/GitNexus · error · GitNexusRcError

${source}: branch name must not contain "..".

Error message

${source}: branch name must not contain "..".

What it means

Thrown by validateBranchName() when the branch name contains '..'. Git interprets '..' and '...' as revision-range operators (X..Y means commits in Y not in X), so a name with '..' is ambiguous and rejected by git refname rules.

Source

Thrown at gitnexus/src/cli/analyze-config.ts:180

  }
  if (trimmed.length > BRANCH_MAX_LENGTH) {
    throw new GitNexusRcError(`${source}: branch name is too long (max ${BRANCH_MAX_LENGTH}).`);
  }
  assertNoHiddenChars(trimmed, source);
  if (/\s/.test(trimmed)) {
    throw new GitNexusRcError(`${source}: branch name must not contain whitespace.`);
  }
  // git ref-name rules (subset): reject characters git itself forbids in refs.
  if (/[~^:?*[\\]/.test(trimmed)) {
    throw new GitNexusRcError(
      `${source}: branch name contains characters not allowed in a git ref (~ ^ : ? * [ \\).`,
    );
  }
  if (trimmed.startsWith('-')) {
    throw new GitNexusRcError(`${source}: branch name must not start with "-".`);
  }
  if (trimmed.includes('..')) {
    throw new GitNexusRcError(`${source}: branch name must not contain "..".`);
  }
  // Git permits a backtick in a ref, but the branch is embedded inside a
  // Markdown inline-code span in the generated AGENTS.md/CLAUDE.md regression
  // example, where a backtick would close the span early and let the rest of
  // the template render as instruction text. Reject it at this single
  // chokepoint so all three tiers (CLI flag, .gitnexusrc, auto-detect via
  // sanitizeDetectedBranch) are covered (#1996 tri-review P1).
  if (trimmed.includes('`')) {
    throw new GitNexusRcError(
      `${source}: branch name must not contain a backtick (it would break the generated Markdown).`,
    );
  }
  return trimmed;
}

/**
 * Best-effort validation for an auto-detected branch (from git). Never throws —
 * returns `undefined` for anything unusable so the resolver falls back to the

View on GitHub (pinned to d540b00184)

Solutions

  1. Replace '..' with a single '.' or a '-' (e.g. 'release/1.2' or 'release/1-2').
  2. Re-type the name carefully to avoid consecutive dots.

Example fix

// before
{ "defaultBranch": "release/1..2" }

// after
{ "defaultBranch": "release/1.2" }
Defensive patterns

Strategy: validation

Validate before calling

function assertNoDoubleDot(name: string): void {
  if (name.includes('..')) {
    throw new Error('branch name must not contain ".."');
  }
}

Type guard

function hasNoDoubleDot(name: string): boolean {
  return typeof name === 'string' && !name.includes('..');
}

Prevention

When it happens

Trigger: Passing a branch name like 'feature..auth', 'release/1..2', or any name where two dots appear consecutively.

Common situations: A version-style name with an ellipsis ('release/1..2'); an accidental double-period from fast typing; a name derived from a path that contained '..'.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/dad862f881c8f69f. Report an issue: GitHub.