{"record":{"id":"473da921a1c00e3b","repo":"pcottle/learnGitBranching","slug":"bad-tag-name","errorCode":null,"errorMessage":"bad-tag-name","messagePattern":"bad-tag-name","errorType":"validation","errorClass":"GitError","httpStatus":null,"severity":"error","filePath":"src/js/git/index.js","lineNumber":752,"sourceCode":"\nGitEngine.prototype.validateAndMakeBranch = function(id, target) {\n  id = this.validateBranchName(id);\n  if (this.doesRefExist(id)) {\n    throw new GitError({\n      msg: intl.str(\n        'bad-branch-name',\n        { branch: id }\n      )\n    });\n  }\n\n  return this.makeBranch(id, target);\n};\n\nGitEngine.prototype.validateAndMakeTag = function(id, target) {\n  id = this.validateBranchName(id);\n  if (this.refs[id]) {\n    throw new GitError({\n      msg: intl.str(\n        'bad-tag-name',\n        { tag: id }\n      )\n    });\n  }\n\n  this.makeTag(id, target);\n};\n\nGitEngine.prototype.makeBranch = function(id, target) {\n  if (this.refs[id]) {\n    var err = new Error();\n    throw new Error('woah already have that ref ' + id + ' ' + err.stack);\n  }\n\n  var branch = new Branch({\n    target: target,","sourceCodeStart":734,"sourceCodeEnd":770,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/git/index.js#L734-L770","documentation":"validateAndMakeTag validates the name via branch-name rules, then rejects the creation if this.refs[id] is already taken (by a tag OR a branch — one flat ref namespace).","triggerScenarios":"`git tag <name>` where <name> already exists as either a tag or a branch.","commonSituations":"Re-running level solutions that tag twice; tagging with a name equal to an existing branch.","solutions":["Pick a new tag name","Remove the existing tag first: `git tag -d <name>`","If it collides with a branch, choose a non-colliding name"],"exampleFix":"// before\ngit tag v1  // v1 exists\n// after\ngit tag v1.1","handlingStrategy":"validation","validationCode":"if (!engine.refs[id]) { engine.validateAndMakeTag(id, target); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check engine.refs before creating tags","Avoid tag names that collide with branches","Drop stale tags before re-running solutions"],"tags":["git","tag","duplicate-ref"],"backgroundTag":"git-ref-already-exists","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}