{"record":{"id":"0ffcbe72101126f9","repo":"cli/cli","slug":"could-not-check-for-binary-extension-w","errorCode":null,"errorMessage":"could not check for binary extension: %w","messagePattern":"could not check for binary extension: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/extension/manager.go","lineNumber":264,"sourceCode":"\tHost     string\n\tTag      string\n\tIsPinned bool\n\t// TODO I may end up not using this; just thinking ahead to local installs\n\tPath string\n}\n\n// Install installs an extension from repo, and pins to commitish if provided\nfunc (m *Manager) Install(repo ghrepo.Interface, target string) error {\n\tisBin, err := isBinExtension(m.client, repo)\n\tif err != nil {\n\t\tif errors.Is(err, releaseNotFoundErr) {\n\t\t\tif ok, err := repoExists(m.client, repo); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if !ok {\n\t\t\t\treturn repositoryNotFoundErr\n\t\t\t}\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"could not check for binary extension: %w\", err)\n\t\t}\n\t}\n\tif isBin {\n\t\treturn m.installBin(repo, target)\n\t}\n\n\ths, err := hasScript(m.client, repo)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !hs {\n\t\treturn fmt.Errorf(\"extension is not installable: no usable release artifact or script found in %s\", ghrepo.FullName(repo))\n\t}\n\n\treturn m.installGit(repo, target)\n}\n\nfunc (m *Manager) installBin(repo ghrepo.Interface, target string) error {","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/cli/cli/blob/0eeec0b92edbe70199f9768522f831d3534f41ad/pkg/cmd/extension/manager.go#L246-L282","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the wrapped error (err) to identify the actual HTTP status or network cause","Run gh auth status and re-authenticate with gh auth refresh if the token is invalid","Wait or reduce request volume if rate limited; check GH_HOST/GH_ENTERPRISE_TOKEN for GHE setups","Verify network/proxy connectivity to the API host (curl the api.github.com releases endpoint)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"client, _ := ghClient() // authenticated *http.Client\nreq, _ := http.NewRequest(\"GET\", fmt.Sprintf(\"https://api.github.com/repos/%s/releases?per_page=1\", ghrepo.FullName(repo)), nil)\nresp, err := client.Do(req)\nif err != nil || resp.StatusCode >= 500 || resp.StatusCode == 403 { /* defer or back off before Install */ }","typeGuard":null,"tryCatchPattern":"err := m.Install(repo, target)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"could not check for binary extension\") {\n        // inspect errors.Unwrap(err): 401/403 => auth, timeout => retry with backoff\n    }\n}","preventionTips":["Validate gh auth status and token scopes before programmatic installs","Wrap Install in a small retry with backoff for transient 5xx/network errors","Pin GH_HOST explicitly for GHES so the releases API endpoint is predictable"],"tags":["extensions","network","api","install"],"backgroundTag":null,"analyzedSha":"0eeec0b92edbe70199f9768522f831d3534f41ad","analyzedAt":"2026-08-15T12:31:05.478Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}