abhigyanpatwari/GitNexus · error · Error

must not contain consecutive slashes

Error message

must not contain consecutive slashes

What it means

validateAutoSyncBranchName rejects branch names containing consecutive slashes ("//"), which git's ref-format rules also forbid. The auto-sync config parser calls this check so that malformed names fail early with a specific message instead of an opaque git error later.

Source

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

    !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();
  const match = /^(\d+)(ms|s|m)?$/.exec(raw);
  if (!match) return Number.NaN;
  const amount = Number(match[1]);

View on GitHub (pinned to 0d1aed942f)

Solutions

  1. Remove the duplicate slash so segments are separated by exactly one "/".
  2. If the name is assembled from parts, filter out empty segments before joining.
  3. Re-run parseAutoSyncConfig to confirm the branch passes validation.

Example fix

// before
branch: "feature//auto-sync"
// after
branch: "feature/auto-sync"
Defensive patterns

Strategy: validation

Validate before calling

if (branch.includes('//')) throw new Error('branch name must not contain consecutive slashes');

Prevention

When it happens

Trigger: parseAutoSyncConfig receives a branch value containing "//", e.g. "feature//auto-sync", typically from joining path segments where one segment was empty.

Common situations: Programmatic name building like `"feature/" + env.SLUG + "/build"` with an empty SLUG, config templating that left a blank segment, or double-pasted separators in hand-edited YAML.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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