Netflix/chaosmonkey · error
unexpected status code
Error message
unexpected status code: %d. body: %s
What it means
Returned by Spinnaker.account when the accounts endpoint responded with a non-200 status and the matched account entry carries no error field, so the raw body is reported as the only clue for why the account listing request failed.
Solutions
- Inspect the response body for the underlying Spinnaker failure (auth, permissions, server error)
- Retry after verifying Spinnaker health if the failure looks transient
- Fix credentials/endpoint config if the body shows an auth problem
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at spinnaker/spinnaker.go:539 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/f6aaa9c1e69af9e6.
Report an issue: GitHub.
Appendix: source
Thrown at spinnaker/spinnaker.go:539
if err != nil {
return ac, errors.Wrapf(err, "body read failed at %s", url)
}
var accounts []account
err = json.Unmarshal(body, &accounts)
if err != nil {
return ac, errors.Wrap(err, "json unmarshal failed")
}
statusKO := resp.StatusCode != http.StatusOK
// Finally find account
for _, a := range accounts {
if a.Name != name {
continue
}
if statusKO {
if a.Error == "" {
return ac, errors.Errorf("unexpected status code: %d. body: %s", resp.StatusCode, body)
}
return ac, errors.Errorf("unexpected status code: %d. error: %s", resp.StatusCode, a.Error)
}
return a, nil
}
return ac, errors.New("the account name doesn't exist")
}
// GetClusterNames returns a list of cluster names for an app
func (s Spinnaker) GetClusterNames(app string, account D.AccountName) (clusters []D.ClusterName, err error) {
url := s.appURL(app)
resp, err := s.client.Get(url)
if err != nil {
return nil, errors.Wrapf(err, "http get failed at %s", url)
}View on GitHub (pinned to eaa28fb761)