{"record":{"id":"8dca70a5499c4987","repo":"Netflix/chaosmonkey","slug":"s-returned-unexpected-status-code-d-body-s","errorCode":null,"errorMessage":"%s returned unexpected status code: %d, body: %s","messagePattern":"(.+?) returned unexpected status code: (.+?), body: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spinnaker/spinnaker.go","lineNumber":202,"sourceCode":"\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"failed to read body from url %s\", url)\n\t}\n\n\tvar info struct {\n\t\tAccountID string `json:\"accountId\"`\n\t\tError     string `json:\"error\"`\n\t}\n\n\terr = json.Unmarshal(body, &info)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"could not parse body of %s as json, body: %s, error\", url, body)\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tif info.Error == \"\" {\n\t\t\treturn \"\", errors.Errorf(\"%s returned unexpected status code: %d, body: %s\", url, resp.StatusCode, body)\n\t\t}\n\n\t\treturn \"\", errors.New(info.Error)\n\t}\n\n\t// Some backends may not have associated account ids\n\tif info.AccountID == \"\" {\n\t\treturn s.alternateAccountID(name)\n\t}\n\n\treturn info.AccountID, nil\n\n}\n\n// alternateAccountID returns an account ID for accounts that don't have their\n// own ids.\nfunc (s Spinnaker) alternateAccountID(name string) (string, error) {\n","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/spinnaker/spinnaker.go#L184-L220","documentation":"Returned by Spinnaker.AccountID when the account-URL response has a non-200 status and Spinnaker's error field is empty, so only the status code and raw body are available to explain the failed account lookup.","triggerScenarios":"Thrown at spinnaker/spinnaker.go:202 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the body for the real cause (often auth failure or unknown account)","Verify the account name exists in Spinnaker","Check API credentials and endpoint configuration"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}