{"record":{"id":"2e79a142437fa861","repo":"pcottle/learnGitBranching","slug":"fatal-no-tags-found-upstream","errorCode":null,"errorMessage":"Fatal: no tags found upstream","messagePattern":"Fatal: no tags found upstream","errorType":"validation","errorClass":"GitError","httpStatus":null,"severity":"error","filePath":"src/js/git/index.js","lineNumber":2794,"sourceCode":"  while (pQueue.length) {\n    var popped = pQueue.pop();\n    var thisID = popped.get('id');\n    if (tagMap[thisID]) {\n      foundTag = tagMap[thisID];\n      break;\n    }\n    // ok keep going\n    numAway.push(popped.get('id'));\n\n    var parents = popped.get('parents');\n    if (parents && parents.length) {\n      pQueue = pQueue.concat(parents);\n      pQueue.sort(this.dateSortFunc);\n    }\n  }\n\n  if (!foundTag) {\n    throw new GitError({\n      msg: intl.todo('Fatal: no tags found upstream')\n    });\n  }\n\n  if (numAway.length === 0) {\n    throw new CommandResult({\n      msg: foundTag\n    });\n  }\n\n  // then join\n  throw new CommandResult({\n    msg: foundTag + '-' + numAway.length + '-g' + startCommit.get('id')\n  });\n};\n\nGitEngine.prototype.renameBranch = function(oldName, newName, force) {\n  var target = this.resolveID(oldName);","sourceCodeStart":2776,"sourceCodeEnd":2812,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/git/index.js#L2776-L2812","documentation":"Thrown by the describe implementation when it walks upstream from the target commit through sorted parents and never encounters a commit carrying a tag. Real git describe fails the same way when no annotated tag is reachable from the commit, and the simulator surfaces intl.todo('Fatal: no tags found upstream').","triggerScenarios":"Calling describe (git describe) on a commit whose ancestry contains zero tags — e.g. a fresh repository with only commits and branches, no tags ever created, or a commit on an orphan history.","commonSituations":"Running git describe before creating any tag; levels/exercises that never set up tags; describing a commit on a side history disconnected from the tagged one.","solutions":["Create a tag on some ancestor commit first (git tag <name> <commit>) then retry describe","Verify the tag is on the current branch's history, not on an unrelated branch","If you need a descriptor without tags, use a fallback like the short commit hash"],"exampleFix":"// before\ngit describe\n// after\ngit tag v1.0 C2\ngit describe","handlingStrategy":"validation","validationCode":"function hasUpstreamTag(engine, commit) {\n  var queue = [commit], seen = {};\n  while (queue.length) {\n    var c = queue.shift();\n    if (c.get('tags').length) return true;\n    c.get('parents').forEach(function(p){ if(!seen[p.get('id')]) { seen[p.get('id')]=1; queue.push(p); } });\n  }\n  return false;\n}","typeGuard":null,"tryCatchPattern":"try { engine.describe(ref); } catch (e) { if (e instanceof GitError) { /* fall back to short sha */ } else throw e; }","preventionTips":["Create at least one tag on the main history before using describe","Fall back to short commit ids when no tags exist"],"tags":["git","describe","tag","ancestry"],"backgroundTag":"git-no-tags-reachable","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}