Netflix/chaosmonkey · error

failed to read body when retrieving spinnaker app names from

Error message

failed to read body when retrieving spinnaker app names from %s: %v

What it means

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.

Source

Thrown at spinnaker/spinnaker.go:361

}

// AppNames returns list of names of all apps
func (s Spinnaker) AppNames() (appnames []string, err error) {
	url := s.appsURL()
	resp, err := s.client.Get(url)
	if err != nil {
		return nil, fmt.Errorf("could not retrieve list of apps from spinnaker url %s: %v", url, err)
	}

	defer func() {
		if cerr := resp.Body.Close(); cerr != nil && err == nil {
			err = fmt.Errorf("failed to close response body from %s: %v", url, err)
		}
	}()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("failed to read body when retrieving spinnaker app names from %s: %v", url, err)
	}
	var apps []spinnakerApp
	err = json.Unmarshal(body, &apps)
	if err != nil {
		return nil, fmt.Errorf("could not parse spinnaker apps list from %s: body: \"%s\": %v", url, string(body), err)
	}

	result := make([]string, len(apps))
	for i, app := range apps {
		result[i] = app.Name
	}

	return result, nil

}

// spinnakerApp returns an app as represented by the Spinnaker API
type spinnakerApp struct {

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Retry AppNames(); mid-body disconnects are often transient
  2. Increase HTTP client timeouts and check network stability between chaosmonkey and Spinnaker
  3. Check Spinnaker gate/clouddriver health and LB timeout settings
  4. Reduce response size if an enormous app list is aggravating slow links
Defensive patterns

Strategy: retry

Try / catch

names, err := spin.AppNames()
if err != nil {
	if strings.Contains(err.Error(), "failed to read body") {
		// connection dropped mid-body: retry with backoff
		names, err = retryWithBackoff(3, spin.AppNames)
	}
	if err != nil { return err }
}

Prevention

When it happens

Trigger: 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.

Common situations: Large apps lists over flaky networks; Spinnaker gate restarting mid-request; read timeouts on slow/unhealthy backends; LB idle-connection cutoffs.

Related errors


AI-assisted analysis of Netflix/chaosmonkey@eaa28fb761 (2026-09-03). Data as JSON: /api/errors/d5bd45e2fea527fb. Report an issue: GitHub.