{"record":{"id":"2de339a24a243cca","repo":"Netflix/chaosmonkey","slug":"failed-to-read-body-from-url-s","errorCode":null,"errorMessage":"failed to read body from url %s","messagePattern":"failed to read body from url (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spinnaker/spinnaker.go","lineNumber":187,"sourceCode":"\n// AccountID returns numerical ID associated with an AWS account\nfunc (s Spinnaker) AccountID(name string) (id string, err error) {\n\turl := s.accountURL(name)\n\n\tresp, err := s.client.Get(url)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"could not retrieve account info for %s from spinnaker url %s\", name, url)\n\t}\n\n\tdefer func() {\n\t\tif cerr := resp.Body.Close(); cerr != nil && err == nil {\n\t\t\terr = errors.Wrapf(err, \"failed to close response body from %s\", url)\n\t\t}\n\t}()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"failed to read body from url %s\", url)\n\t}\n\n\tvar info struct {\n\t\tAccountID string `json:\"accountId\"`\n\t\tError     string `json:\"error\"`\n\t}\n\n\terr = json.Unmarshal(body, &info)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"could not parse body of %s as json, body: %s, error\", url, body)\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tif info.Error == \"\" {\n\t\t\treturn \"\", errors.Errorf(\"%s returned unexpected status code: %d, body: %s\", url, resp.StatusCode, body)\n\t\t}\n\n\t\treturn \"\", errors.New(info.Error)","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/spinnaker/spinnaker.go#L169-L205","documentation":"Fires in Spinnaker.AccountID when ioutil.ReadAll cannot read the HTTP response body returned by the Spinnaker account-info endpoint (connection reset mid-stream, truncated response, or body already consumed). The HTTP request itself succeeded, so the wrapped error reflects an I/O failure on the body stream for the given account URL.","triggerScenarios":"Thrown at spinnaker/spinnaker.go:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request with backoff for transient network interruptions","Set an explicit http.Client timeout to detect stalled streams","Check Spinnaker server health if read failures recur"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eaa28fb761c0ebe8644d1333e5d164e9cc3071e9","analyzedAt":"2026-09-03T17:04:39.020Z","contentChangedAt":"2026-09-03T17:04:39.020Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}