{"record":{"id":"d84e1ff9a69f4ac0","repo":"ory/hydra","slug":"unable-to-read-the-http-response-body","errorCode":null,"errorMessage":"unable to read the HTTP response body","messagePattern":"unable to read the HTTP response body","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"oryx/osx/file.go","lineNumber":187,"sourceCode":"\n\t\t//#nosec G304 -- false positive\n\t\tbytes, err = os.ReadFile(parsed.Host + parsed.Path)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to read the file\")\n\t\t}\n\tcase \"http\", \"https\":\n\t\tif o.disableHTTPLoader {\n\t\t\treturn nil, errors.New(\"http(s) loader disabled\")\n\t\t}\n\t\tresp, err := o.hc.Get(parsed.String())\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to load remote file\")\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\tbytes, err = io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to read the HTTP response body\")\n\t\t}\n\tcase \"base64\":\n\t\tif o.disableBase64Loader {\n\t\t\treturn nil, errors.New(\"base64 loader disabled\")\n\t\t}\n\n\t\tif o.disableResilientBase64Loader {\n\t\t\tbytes, err = o.base64enc.DecodeString(strings.TrimPrefix(source, \"base64://\"))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"unable to base64 decode the location\")\n\t\t\t}\n\t\t\treturn bytes, nil\n\t\t}\n\n\t\tfor _, enc := range []*base64.Encoding{\n\t\t\tbase64.StdEncoding,\n\t\t\tbase64.URLEncoding,\n\t\t\tbase64.RawURLEncoding,","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/osx/file.go#L169-L205","documentation":"Returned by readFile when io.ReadAll on a successfully opened HTTP response body fails mid-stream — connection reset, premature close, or read timeout after the request itself succeeded. Partial content is discarded.","triggerScenarios":"Thrown at oryx/osx/file.go:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the fetch; transient connection drops are the usual cause","Increase the HTTP client's read/response timeout via WithHTTPClient","Check whether the server prematurely closes large responses (content-length mismatch)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4174065ffb052799890f7480f5360a877a67ffc1","analyzedAt":"2026-09-03T14:52:41.581Z","contentChangedAt":"2026-09-03T14:52:41.581Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}