Netflix/chaosmonkey · error

unexpected status code: %d. error: %s

Error message

unexpected status code: %d. error: %s

What it means

Returned by Spinnaker.account when the accounts endpoint responded non-200 but the matched account entry includes an error field; that per-account error message (e.g. permission denied for the account) is surfaced to explain the failure.

Source

Thrown at spinnaker/spinnaker.go:542

	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)
	}

	defer func() {
		if cerr := resp.Body.Close(); cerr != nil && err == nil {

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Read the reported per-account error and address its cause (often credentials or permissions for that account)
  2. Verify the Spinnaker service account can access the named account
  3. Retry once the underlying Spinnaker-side issue is resolved
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at spinnaker/spinnaker.go:542 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/d67674993bc95c0e. Report an issue: GitHub.