{"record":{"id":"d04e438eeda96324","repo":"abhigyanpatwari/GitNexus","slug":"must-not-end-with-or","errorCode":null,"errorMessage":"must not end with \"/\" or \".\"","messagePattern":"must not end with \"/\" or \"\\.\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/auto-sync/config.ts","lineNumber":343,"sourceCode":"    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;\n  const raw = String(value ?? '').trim();\n  const match = /^(\\d+)(ms|s|m)?$/.exec(raw);\n  if (!match) return Number.NaN;","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/core/auto-sync/config.ts#L325-L361","documentation":"validateAutoSyncBranchName rejects branch names ending with \"/\" or \".\", mirroring git's own check-ref-format rules: a ref may not end with a slash or dot. The auto-sync config parser enforces this before handing the branch name to git, so malformed names fail at config-parse time with a clear message.","triggerScenarios":"parseAutoSyncConfig receives a branch value whose last character is \"/\" or \".\", e.g. \"feature/\" or \"release.v1.\"","commonSituations":"Trailing slashes/dots introduced by string concatenation in generated configs, hand-edited YAML with typos, or copying a path-like value (\"refs/heads/main/\") instead of the branch name.","solutions":["Strip the trailing \"/\" or \".\" from the branch name in the auto-sync config.","If the name is built programmatically, trim trailing separators/dots before assigning it.","Validate with git check-ref-format or re-run parseAutoSyncConfig to confirm."],"exampleFix":"// before\nbranch: \"feature/auto-sync/\"\n// after\nbranch: \"feature/auto-sync\"","handlingStrategy":"validation","validationCode":"if (/[/$.]$/.test(branch)) throw new Error('branch name must not end with \"/\" or \".\"');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Trim the assembled branch name and strip trailing separators/dots before writing config.","Validate names with `git check-ref-format --branch` before committing config changes.","Avoid building branch names by naive path concatenation."],"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-14T05:17:10.506Z"}