cli/cli · error

could not check for binary extension: %w

Error message

could not check for binary extension: %w

What it means

Thrown by Manager.Install when isBinExtension fails while probing the repo's releases for a precompiled binary asset. The %w wraps the underlying HTTP/API error, so the real cause (auth failure, DNS, 5xx, permission) is in the wrapped error. It only fires for non-release-not-found errors; a missing release is handled separately by checking repo existence.

Source

Thrown at pkg/cmd/extension/manager.go:264

	Host     string
	Tag      string
	IsPinned bool
	// TODO I may end up not using this; just thinking ahead to local installs
	Path string
}

// Install installs an extension from repo, and pins to commitish if provided
func (m *Manager) Install(repo ghrepo.Interface, target string) error {
	isBin, err := isBinExtension(m.client, repo)
	if err != nil {
		if errors.Is(err, releaseNotFoundErr) {
			if ok, err := repoExists(m.client, repo); err != nil {
				return err
			} else if !ok {
				return repositoryNotFoundErr
			}
		} else {
			return fmt.Errorf("could not check for binary extension: %w", err)
		}
	}
	if isBin {
		return m.installBin(repo, target)
	}

	hs, err := hasScript(m.client, repo)
	if err != nil {
		return err
	}
	if !hs {
		return fmt.Errorf("extension is not installable: no usable release artifact or script found in %s", ghrepo.FullName(repo))
	}

	return m.installGit(repo, target)
}

func (m *Manager) installBin(repo ghrepo.Interface, target string) error {

View on GitHub (pinned to 0eeec0b92e)

Solutions

  1. Inspect the wrapped error (err) to identify the actual HTTP status or network cause
  2. Run gh auth status and re-authenticate with gh auth refresh if the token is invalid
  3. Wait or reduce request volume if rate limited; check GH_HOST/GH_ENTERPRISE_TOKEN for GHE setups
  4. Verify network/proxy connectivity to the API host (curl the api.github.com releases endpoint)
Defensive patterns

Strategy: retry

Validate before calling

client, _ := ghClient() // authenticated *http.Client
req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/repos/%s/releases?per_page=1", ghrepo.FullName(repo)), nil)
resp, err := client.Do(req)
if err != nil || resp.StatusCode >= 500 || resp.StatusCode == 403 { /* defer or back off before Install */ }

Try / catch

err := m.Install(repo, target)
if err != nil {
    if strings.HasPrefix(err.Error(), "could not check for binary extension") {
        // inspect errors.Unwrap(err): 401/403 => auth, timeout => retry with backoff
    }
}

Prevention

When it happens

Trigger: Calling gh extension install (or Manager.Install) when the GitHub API request to list the repo's releases returns an unexpected error other than releaseNotFoundErr, e.g. 401/403 bad token, 403 rate limit, network timeout, or GHES host unreachable.

Common situations: Expired or revoked GH_TOKEN; GHES instance without the releases API; proxy or corporate TLS interception breaking api requests; heavy CI usage hitting secondary rate limits.

Related errors


AI-assisted analysis of cli/cli@0eeec0b92e (2026-08-15). Data as JSON: /api/errors/0ffcbe72101126f9. Report an issue: GitHub.