{"record":{"id":"42b72a74c8702179","repo":"Netflix/chaosmonkey","slug":"no-cloudprovider-field-in-response-body","errorCode":null,"errorMessage":"no cloudProvider field in response body","messagePattern":"no cloudProvider field in response body","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spinnaker/spinnaker.go","lineNumber":490,"sourceCode":"\n\tvar asgs []spinnakerServerGroup\n\terr = json.Unmarshal(body, &asgs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse body of spinnaker asgs url (%s): body: '%s'. %v\", url, string(body), err)\n\t}\n\n\treturn asgs, nil\n}\n\n// CloudProvider returns the cloud provider for a given account name\nfunc (s Spinnaker) CloudProvider(name string) (provider string, err error) {\n\taccount, err := s.account(name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif account.CloudProvider == \"\" {\n\t\treturn \"\", errors.New(\"no cloudProvider field in response body\")\n\t}\n\n\treturn account.CloudProvider, nil\n}\n\n// account represents a spinnaker account\ntype account struct {\n\tCloudProvider string `json:\"cloudProvider\"`\n\tName          string `json:\"name\"`\n\tError         string `json:\"error\"`\n}\n\n// account returns an account by its name\nfunc (s Spinnaker) account(name string) (account, error) {\n\turl := s.accountsURL(true)\n\tresp, err := s.client.Get(url)\n\tvar ac account\n","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/spinnaker/spinnaker.go#L472-L508","documentation":"CloudProvider() resolves the cloud provider (e.g. aws) for an account via the Spinnaker accounts endpoint, then requires the response to include a non-empty cloudProvider field. The Spinnaker server returned an account object without that field, so Chaos Monkey cannot determine the provider.","triggerScenarios":"Calling CloudProvider(name) (as GetApp does) where s.account(name) succeeds (HTTP 200, parseable JSON) but the decoded account struct's CloudProvider is the empty string — i.e. the response JSON lacks a \"cloudProvider\" key or it is null/empty.","commonSituations":"Spinnaker backends/other cloud providers that don't populate cloudProvider for certain accounts; custom or older clouddriver versions with different response schemas; pointing chaosmonkey at a non-AWS account (e.g. kubernetes) that has no cloudProvider set.","solutions":["Verify with curl that GET <spinnaker>/v1/<account>/... (the accounts URL) actually returns a cloudProvider field for this account","Check the clouddriver/spinnaker version and upgrade if cloudProvider is known to be missing in responses","Exclude that account from chaosmonkey's enabled accounts if it is a non-AWS account without a provider","Confirm you are querying the correct account name — a different, fully-populated account should include the field"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before relying on an account, confirm cloudProvider is populated:\nvar accounts []struct{ Name, CloudProvider string `json:\"cloudProvider\"` }\n// GET <endpoint>/accounts, unmarshal, and check:\nfor _, a := range accounts {\n\tif a.CloudProvider == \"\" {\n\t\tlog.Printf(\"account %s has no cloudProvider; excluding\", a.Name)\n\t}\n}","typeGuard":null,"tryCatchPattern":"provider, err := spin.CloudProvider(app)\nif err != nil {\n\tif strings.Contains(err.Error(), \"no cloudProvider field\") {\n\t\tlog.Printf(\"skipping app %s: no cloud provider info\", app)\n\t\treturn nil\n\t}\n\treturn err\n}","preventionTips":["Only enable AWS accounts in chaosmonkey config","Verify account responses include cloudProvider after Spinnaker upgrades","Exclude non-AWS (e.g. kubernetes) accounts from the enabled list","Pin/test clouddriver versions known to return cloudProvider"],"tags":["spinnaker","api","response-schema"],"backgroundTag":"api-response-missing-field","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"}