mislav/hub · error

Unable to find release with tag name `%s'

Error message

Unable to find release with tag name `%s'

What it means

FetchRelease lists releases filtered by tag name and returns this error when the resulting slice is empty, i.e. no release on the repository matches the given tag. Note GitHub distinguishes tags from releases: a tag can exist with no published release attached.

Source

Thrown at github/client.go:373

					break
				}
			}
		}
	}

	return
}

func (client *Client) FetchRelease(project *Project, tagName string) (*Release, error) {
	releases, err := client.FetchReleases(project, 100, func(release *Release) bool {
		return release.TagName == tagName
	})

	if err != nil {
		return nil, err
	}
	if len(releases) < 1 {
		return nil, fmt.Errorf("Unable to find release with tag name `%s'", tagName)
	}
	return &releases[0], nil
}

func (client *Client) CreateRelease(project *Project, releaseParams *Release) (release *Release, err error) {
	api, err := client.simpleAPI()
	if err != nil {
		return
	}

	res, err := api.PostJSON(fmt.Sprintf("repos/%s/%s/releases", project.Owner, project.Name), releaseParams)
	if err = checkStatus(201, "creating release", res, err); err != nil {
		return
	}

	release = &Release{}
	err = res.Unmarshal(release)
	return

View on GitHub (pinned to 5c547ed804)

Solutions

  1. Confirm the exact release tag on the repo (`gh release list`) and use that string, including any `v` prefix.
  2. If the release is a draft, publish it or use a token with access to view drafts (drafts are only visible to collaborators).
  3. Create the release for the tag: `gh release create <tag>` if it should exist.
  4. Add a fallback in code to list all releases and match semantically rather than by exact tag string.

Example fix

// before
rel, err := client.FetchRelease(project, tagName) // fails on "1.2.0" vs "v1.2.0"
// after
tagName = tagName
if !strings.HasPrefix(tagName, "v") { tagName = "v" + tagName }
rel, err := client.FetchRelease(project, tagName)
Defensive patterns

Strategy: validation

Validate before calling

releases, _, err := api.Client.Repositories.ListReleases(ctx, owner, name, nil)
if err != nil { return err }
found := false
for _, r := range releases { if r.GetTagName() == tagName { found = true } }
if !found { return fmt.Errorf("no release for tag %s", tagName) }

Try / catch

rel, err := client.FetchRelease(project, tagName)
if err != nil && strings.Contains(err.Error(), "Unable to find release") {
    return fmt.Errorf("tag %q has no published release; run: gh release create %s", tagName, tagName)
}

Prevention

When it happens

Trigger: Calling FetchRelease(project, tagName) where the repo has zero releases with that exact tag name — the tag was never released, the release is a draft (not visible to the token), or the tag name case/prefix doesn't match exactly (e.g. `1.2.0` vs `v1.2.0`).

Common situations: Automating downloads of release assets for a version string that has no matching published release; CI deploying 'latest' before the release step ran; releases kept as drafts until QA; repo using tags without creating GitHub Releases.

Related errors


AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01). Data as JSON: /api/errors/63555e005c15a4d4. Report an issue: GitHub.