{"record":{"id":"9adde8d6a891131d","repo":"abhigyanpatwari/GitNexus","slug":"must-not-start-with-9adde8","errorCode":null,"errorMessage":"must not start with \"/\"","messagePattern":"must not start with \"/\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/auto-sync/config.ts","lineNumber":340,"sourceCode":"    repoName === '.' ||\n    repoName === '..' ||\n    repoName === 'unknown' ||\n    repoName.startsWith('-') ||\n    !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;","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/core/auto-sync/config.ts#L322-L358","documentation":"Git refs must not begin with '/', so validateAutoSyncBranchName rejects branches starting with a slash. A leading slash would also produce a malformed ref path (refs/heads//name) and is reserved syntax, so the library throws at parse time.","triggerScenarios":"branches: [\"/main\"] or [\"/feature/login\"]; the leading 'refs/heads/' prefix accidentally left on: [\"refs/heads/main\"] is fine, but a half-stripped [\"/heads/main\"] is not; copy-paste that included a path separator from a URL.","commonSituations":"Developers pasting full ref paths or URLs like https://host/owner/repo/tree/main and keeping the slash; scripts that join paths and prepend '/' by mistake.","solutions":["Remove the leading slash and use the bare branch name: /main → main.","Do not include refs/heads/ — auto-sync expects the short branch name only.","If the branch is nested, keep internal slashes but not a leading one: feature/login is valid."],"exampleFix":"// before\nbranches:\n  - \"/main\"\n// after\nbranches:\n  - main","handlingStrategy":"validation","validationCode":"function noLeadingSlash(b) {\n  return typeof b === 'string' && !b.startsWith('/');\n}\nfunction normalizeBranch(b) {\n  return b.replace(/^refs\\/heads\\//, '').replace(/^\\/+/, '');\n}\nconst branches = (cfg.branches ?? []).map(normalizeBranch);\nif (!branches.every(noLeadingSlash)) throw new Error('branches must not start with \"/\"');","typeGuard":null,"tryCatchPattern":"try {\n  validateAutoSyncBranchName(branch);\n} catch (e) {\n  if (String(e.message).includes('must not start with \"/\"')) {\n    log.error(`Strip the leading slash / refs/heads/ prefix from '${branch}'.`);\n  }\n  throw e;\n}","preventionTips":["Configure short branch names (main), not full ref paths (refs/heads/main).","Normalize values derived from URLs or ref paths before saving.","Keep internal slashes for nested names but never a leading one."],"tags":["config","git","branch","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"0d1aed942f0e8b5d3bac27519fff441aceea722d","analyzedAt":"2026-09-08T00:40:44.970Z","contentChangedAt":"2026-09-08T00:40:44.970Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}