{"record":{"id":"5730f5c940dd1aa1","repo":"abhigyanpatwari/GitNexus","slug":"must-not-contain-consecutive-slashes","errorCode":null,"errorMessage":"must not contain consecutive slashes","messagePattern":"must not contain consecutive slashes","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/auto-sync/config.ts","lineNumber":344,"sourceCode":"    !REMOTE_REPO_NAME_PATTERN.test(repoName)\n  ) {\n    throw new Error(\n      'repository name must use only letters, digits, \".\", \"_\", or \"-\" and must not be \"unknown\"',\n    );\n  }\n}\n\nexport function validateAutoSyncBranchName(branch: string): void {\n  if (!branch.trim()) throw new Error('must not be empty');\n  if (/[\\s\\0-\\x1f\\x7f]/.test(branch))\n    throw new Error('must not contain whitespace or control characters');\n  if (/[~^:?*[\\\\]/.test(branch)) throw new Error('contains characters not allowed in a git ref');\n  if (branch.startsWith('-')) throw new Error('must not start with \"-\"');\n  if (branch.startsWith('/')) throw new Error('must not start with \"/\"');\n  if (branch.includes('..')) throw new Error('must not contain \"..\"');\n  if (branch.includes('`')) throw new Error('must not contain backticks');\n  if (branch.endsWith('/') || branch.endsWith('.')) throw new Error('must not end with \"/\" or \".\"');\n  if (branch.includes('//')) throw new Error('must not contain consecutive slashes');\n  if (branch.includes('@{')) throw new Error('must not contain \"@{\"');\n  if (\n    branch\n      .split('/')\n      .some(\n        (component) =>\n          component.startsWith('.') || component.endsWith('.') || component.endsWith('.lock'),\n      )\n  )\n    throw new Error('must not contain hidden, trailing-dot, or .lock path components');\n}\n\nexport function parseDurationMs(value: unknown): number {\n  if (typeof value === 'number') return value * 1_000;\n  const raw = String(value ?? '').trim();\n  const match = /^(\\d+)(ms|s|m)?$/.exec(raw);\n  if (!match) return Number.NaN;\n  const amount = Number(match[1]);","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/core/auto-sync/config.ts#L326-L362","documentation":"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.","triggerScenarios":"parseAutoSyncConfig receives a branch value containing \"//\", e.g. \"feature//auto-sync\", typically from joining path segments where one segment was empty.","commonSituations":"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.","solutions":["Remove the duplicate slash so segments are separated by exactly one \"/\".","If the name is assembled from parts, filter out empty segments before joining.","Re-run parseAutoSyncConfig to confirm the branch passes validation."],"exampleFix":"// before\nbranch: \"feature//auto-sync\"\n// after\nbranch: \"feature/auto-sync\"","handlingStrategy":"validation","validationCode":"if (branch.includes('//')) throw new Error('branch name must not contain consecutive slashes');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When joining path segments, filter out empty segments first: parts.filter(Boolean).join('/').","Check templated configs for unfilled placeholders that collapse to empty segments.","Run a ref-format validation in CI on generated branch names."],"tags":["config","git","validation","auto-sync"],"backgroundTag":"invalid-config-value","analyzedSha":"0d1aed942f0e8b5d3bac27519fff441aceea722d","analyzedAt":"2026-09-08T00:40:44.970Z","contentChangedAt":"2026-09-08T00:40:44.970Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}