abhigyanpatwari/GitNexus · error · Error

must not contain ".."

Error message

must not contain ".."

What it means

Git forbids '..' in ref names because it denotes a range between two refs (a..b), so validateAutoSyncBranchName rejects any branch containing a '..' substring. The check runs at config parse time via parseAutoSyncBranchName's caller parseAutoSyncConfig, before git is invoked.

Source

Thrown at gitnexus/src/core/auto-sync/config.ts:341

    repoName === '..' ||
    repoName === 'unknown' ||
    repoName.startsWith('-') ||
    !REMOTE_REPO_NAME_PATTERN.test(repoName)
  ) {
    throw new Error(
      'repository name must use only letters, digits, ".", "_", or "-" and must not be "unknown"',
    );
  }
}

export function validateAutoSyncBranchName(branch: string): void {
  if (!branch.trim()) throw new Error('must not be empty');
  if (/[\s\0-\x1f\x7f]/.test(branch))
    throw new Error('must not contain whitespace or control characters');
  if (/[~^:?*[\\]/.test(branch)) throw new Error('contains characters not allowed in a git ref');
  if (branch.startsWith('-')) throw new Error('must not start with "-"');
  if (branch.startsWith('/')) throw new Error('must not start with "/"');
  if (branch.includes('..')) throw new Error('must not contain ".."');
  if (branch.includes('`')) throw new Error('must not contain backticks');
  if (branch.endsWith('/') || branch.endsWith('.')) throw new Error('must not end with "/" or "."');
  if (branch.includes('//')) throw new Error('must not contain consecutive slashes');
  if (branch.includes('@{')) throw new Error('must not contain "@{"');
  if (
    branch
      .split('/')
      .some(
        (component) =>
          component.startsWith('.') || component.endsWith('.') || component.endsWith('.lock'),
      )
  )
    throw new Error('must not contain hidden, trailing-dot, or .lock path components');
}

export function parseDurationMs(value: unknown): number {
  if (typeof value === 'number') return value * 1_000;
  const raw = String(value ?? '').trim();

View on GitHub (pinned to 0d1aed942f)

Solutions

  1. If you wanted a range, configure the individual branch(es) instead — ranges are not branch names.
  2. Replace '..' with '.' or '-' in the name: v1..0 → v1.0 or v1-0.
  3. Verify against `git branch --list` that the configured name matches a real branch.
  4. Note a single dot is fine (release.1); only the two-dot sequence is rejected.

Example fix

// before
branches:
  - "main..dev"
// after
branches:
  - main
  - dev
Defensive patterns

Strategy: validation

Validate before calling

function noDotDot(b) {
  return typeof b === 'string' && !b.includes('..');
}
const bad = (cfg.branches ?? []).filter((b) => !noDotDot(b));
if (bad.length) throw new Error(`branches must not contain "..": ${JSON.stringify(bad)}`);

Try / catch

try {
  validateAutoSyncBranchName(branch);
} catch (e) {
  if (String(e.message).includes('must not contain ".."')) {
    log.error(`'${branch}' contains '..' (a git range); list individual branches instead.`);
  }
  throw e;
}

Prevention

When it happens

Trigger: branches: ["main..dev"] (a range expression, not a branch), ["rel..2"], or any name with two consecutive dots anywhere — including harmless-looking names like "v1..0" or "foo..bar".

Common situations: Developer pasted a git log range or diff expression as a branch; version strings with double dots from other ecosystems; typos like "feature..fix" when meaning "feature.fix".

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-09-08). Data as JSON: /api/errors/5d065f578c28c629. Report an issue: GitHub.