{"record":{"id":"d5bd45e2fea527fb","repo":"Netflix/chaosmonkey","slug":"failed-to-read-body-when-retrieving-spinnaker-app","errorCode":null,"errorMessage":"failed to read body when retrieving spinnaker app names from %s: %v","messagePattern":"failed to read body when retrieving spinnaker app names from (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spinnaker/spinnaker.go","lineNumber":361,"sourceCode":"}\n\n// AppNames returns list of names of all apps\nfunc (s Spinnaker) AppNames() (appnames []string, err error) {\n\turl := s.appsURL()\n\tresp, err := s.client.Get(url)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not retrieve list of apps from spinnaker url %s: %v\", url, err)\n\t}\n\n\tdefer func() {\n\t\tif cerr := resp.Body.Close(); cerr != nil && err == nil {\n\t\t\terr = fmt.Errorf(\"failed to close response body from %s: %v\", url, err)\n\t\t}\n\t}()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read body when retrieving spinnaker app names from %s: %v\", url, err)\n\t}\n\tvar apps []spinnakerApp\n\terr = json.Unmarshal(body, &apps)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not parse spinnaker apps list from %s: body: \\\"%s\\\": %v\", url, string(body), err)\n\t}\n\n\tresult := make([]string, len(apps))\n\tfor i, app := range apps {\n\t\tresult[i] = app.Name\n\t}\n\n\treturn result, nil\n\n}\n\n// spinnakerApp returns an app as represented by the Spinnaker API\ntype spinnakerApp struct {","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/spinnaker/spinnaker.go#L343-L379","documentation":"AppNames() reads the full response body with ioutil.ReadAll after fetching the Spinnaker apps list; if that read fails (connection reset mid-body, truncated response, timeout while streaming), the request is wrapped in this error naming the URL.","triggerScenarios":"Calling AppNames() when ioutil.ReadAll(resp.Body) returns a non-nil error — the HTTP connection dropped or timed out while reading the response body from the Spinnaker apps endpoint.","commonSituations":"Large apps lists over flaky networks; Spinnaker gate restarting mid-request; read timeouts on slow/unhealthy backends; LB idle-connection cutoffs.","solutions":["Retry AppNames(); mid-body disconnects are often transient","Increase HTTP client timeouts and check network stability between chaosmonkey and Spinnaker","Check Spinnaker gate/clouddriver health and LB timeout settings","Reduce response size if an enormous app list is aggravating slow links"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"names, err := spin.AppNames()\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to read body\") {\n\t\t// connection dropped mid-body: retry with backoff\n\t\tnames, err = retryWithBackoff(3, spin.AppNames)\n\t}\n\tif err != nil { return err }\n}","preventionTips":["Set generous HTTP client read timeouts","Ensure LB/proxy idle timeouts exceed Spinnaker response times","Check network stability between chaosmonkey and Spinnaker","Monitor Spinnaker gate health"],"tags":["network","http","io"],"backgroundTag":"http-body-read-failed","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"}