{"record":{"id":"489044395e54b13a","repo":"getsops/sops","slug":"unexpected-status-code-d","errorCode":null,"errorMessage":"unexpected status code: %d","messagePattern":"unexpected status code: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"version/version.go","lineNumber":185,"sourceCode":"\t\t// Follow HTTP 301 redirects, which may be present due to the\n\t\t// repository being renamed. But do not follow HTTP 302 redirects,\n\t\t// which is what GitHub uses to redirect to the latest release.\n\t\tif req.Response.StatusCode == 302 {\n\t\t\treturn http.ErrUseLastResponse\n\t\t}\n\t\treturn nil\n\t}\n\n\tresp, err := client.Head(fmt.Sprintf(\"%s/%s/releases/latest\", f.endpoint, repository))\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\tif resp.Body != nil {\n\t\tdefer resp.Body.Close()\n\t}\n\n\tif resp.StatusCode < 300 || resp.StatusCode > 399 {\n\t\treturn \"\", \"\", fmt.Errorf(\"unexpected status code: %d\", resp.StatusCode)\n\t}\n\n\tlocation := resp.Header.Get(\"Location\")\n\tif location == \"\" {\n\t\treturn \"\", \"\", fmt.Errorf(\"missing Location header\")\n\t}\n\n\ttagMarker := \"releases/tag/\"\n\tif tagIndex := strings.Index(location, tagMarker); tagIndex != -1 {\n\t\treturn location[tagIndex+len(tagMarker):], location, nil\n\t}\n\treturn \"\", \"\", fmt.Errorf(\"unexpected Location header: %s\", location)\n}\n\n// LatestReleaseUsingAPI retrieves the most recent release version from the\n// GitHub API. It returns the latest version as a string, along with its\n// corresponding URL, or an error in case of request failure or parsing issues\n// with the response.","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/version/version.go#L167-L203","documentation":"Error \"unexpected status code: %d\" thrown in getsops/sops.","triggerScenarios":"Thrown at version/version.go:185 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"}