{"record":{"id":"6bc2aa360f4ead79","repo":"getsops/sops","slug":"github-api-request-failed-with-status-code-d","errorCode":null,"errorMessage":"GitHub API request failed with status code: %d","messagePattern":"GitHub API request failed with status code: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"version/version.go","lineNumber":225,"sourceCode":"// However, it can be affected by GitHub API rate limiting.\nfunc (f releaseFetcher) LatestReleaseUsingAPI(repository string) (tag, url string, err error) {\n\treq, err := http.NewRequest(http.MethodGet, fmt.Sprintf(\"%s/%s/releases/latest\", f.apiEndpoint, repository), nil)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treq.Header.Set(\"Accept\", \"application/vnd.github+json\")\n\treq.Header.Set(\"X-GitHub-Api-Version\", \"2022-11-28\")\n\n\tres, err := cleanhttp.DefaultClient().Do(req)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"GitHub API request failed: %v\", err)\n\t}\n\tif res.Body != nil {\n\t\tdefer res.Body.Close()\n\t}\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn \"\", \"\", fmt.Errorf(\"GitHub API request failed with status code: %d\", res.StatusCode)\n\t}\n\n\ttype release struct {\n\t\tURL string `json:\"html_url\"`\n\t\tTag string `json:\"tag_name\"`\n\t}\n\tvar m release\n\tif err := json.NewDecoder(res.Body).Decode(&m); err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treturn m.Tag, m.URL, nil\n}\n","sourceCodeStart":207,"sourceCodeEnd":238,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/version/version.go#L207-L238","documentation":"Error \"GitHub API request failed with status code: %d\" thrown in getsops/sops.","triggerScenarios":"Thrown at version/version.go:225 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"13442bb98183887d7a9ac09ec8ab0564673a59d8","analyzedAt":"2026-09-01T03:53:00.447Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}