Netflix/chaosmonkey · error

failed to read body from url %s

Error message

failed to read body from url %s

What it means

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.

Source

Thrown at spinnaker/spinnaker.go:187

// AccountID returns numerical ID associated with an AWS account
func (s Spinnaker) AccountID(name string) (id string, err error) {
	url := s.accountURL(name)

	resp, err := s.client.Get(url)
	if err != nil {
		return "", errors.Wrapf(err, "could not retrieve account info for %s from spinnaker url %s", name, url)
	}

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

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return "", errors.Wrapf(err, "failed to read body from url %s", url)
	}

	var info struct {
		AccountID string `json:"accountId"`
		Error     string `json:"error"`
	}

	err = json.Unmarshal(body, &info)
	if err != nil {
		return "", errors.Wrapf(err, "could not parse body of %s as json, body: %s, error", url, body)
	}

	if resp.StatusCode != http.StatusOK {
		if info.Error == "" {
			return "", errors.Errorf("%s returned unexpected status code: %d, body: %s", url, resp.StatusCode, body)
		}

		return "", errors.New(info.Error)

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Retry the request with backoff for transient network interruptions
  2. Set an explicit http.Client timeout to detect stalled streams
  3. Check Spinnaker server health if read failures recur
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at spinnaker/spinnaker.go:187 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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