pcottle/learnGitBranching · error · GitError

No tag found, nothing to remove

Error message

No tag found, nothing to remove

What it means

The tag-removal path iterates the tag collection looking for a matching tag id; if no tag matches the given tagID, tagToRemove stays undefined and this error is thrown ('No tag found, nothing to remove').

Source

Thrown at src/js/git/commands.js:1089

    execute: function(engine, command) {
      var generalArgs = command.getGeneralArgs();
      var commandOptions = command.getOptionsMap();

      if (commandOptions['-d']) {
        var tagID = commandOptions['-d'];
        var tagToRemove;

        assertIsRef(engine, tagID);

        command.oneArgImpliedHead(tagID);
        engine.tagCollection.each(function(tag) {
          if(tag.get('id') == tagID){
            tagToRemove = tag;
          }
        }, true);

        if(tagToRemove == undefined){
          throw new GitError({
            msg: intl.todo(
              'No tag found, nothing to remove'
            )
          });
        }

        engine.tagCollection.remove(tagToRemove);
        delete engine.refs[tagID];

        engine.gitVisuals.refreshTree();
        return;
      }

      if (generalArgs.length === 0) {
        var tags = engine.getTags();
        engine.printTags(tags);
        return;
      }

View on GitHub (pinned to 5b09d0ff96)

Solutions

  1. List tags with `git tag` to confirm the exact name
  2. Delete using the exact id shown by the listing
  3. Avoid double-executing delete commands (retry logic in scripts)

Example fix

// before
git tag -d v1.0  // tag actually named v1
// after
git tag
git tag -d v1
Defensive patterns

Strategy: validation

Validate before calling

var exists = engine.tagCollection.some(t => t.get('id') === tagID);
if (exists) { /* delete ok */ }

Prevention

When it happens

Trigger: Running the tag deletion command with a tag name/id that does not exist (typo, already removed, or scoped to a different repo).

Common situations: Retrying a tag delete after it already succeeded; casing or whitespace typos in the tag name.

Related errors


AI-assisted analysis of pcottle/learnGitBranching@5b09d0ff96 (2026-08-27). Data as JSON: /api/errors/ffcf22e94914451b. Report an issue: GitHub.