{"record":{"id":"9a6046a291ea3445","repo":"Netflix/chaosmonkey","slug":"info-error","errorCode":null,"errorMessage":"info.Error","messagePattern":"info\\.Error","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spinnaker/spinnaker.go","lineNumber":205,"sourceCode":"\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\n\t// Sanity check: this should never be called with \"prod\" or \"test\" as an\n\t// argument, since this would result in infinite recursion\n\tif name == \"prod\" || name == \"test\" {","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/spinnaker/spinnaker.go#L187-L223","documentation":"AccountID() fetches the AWS account ID for a named Spinnaker account. When the Spinnaker API returns a non-200 status, the response body may carry an \"error\" field; this error re-surfaces that server-provided message verbatim via errors.New(info.Error).","triggerScenarios":"Calling AccountID(name) (directly or via alternateAccountID) and the Spinnaker accounts endpoint replies with a status code other than 200 AND a JSON body containing a non-empty \"error\" field.","commonSituations":"Spinnake clouddriver returning 404 for an unknown account name; auth/TLS failures producing 401/403; the Spinnaker backend reporting its own internal errors with an error payload.","solutions":["Check the error text returned: it is the message Spinnaker itself sent, which usually names the real problem (unknown account, auth denied, etc.)","Verify the account name exists in Spinnaker (GET /accounts) and matches exactly (case-sensitive)","Confirm the TLS client cert is accepted by the Spinnaker endpoint (401/403 usually means cert auth failed)","Inspect Spinnaker/clouddriver logs for the corresponding request error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check that the account exists before calling AccountID:\nresp, err := http.Get(endpoint + \"/accounts\")\n// ... decode and ensure the desired account name is present in the list","typeGuard":null,"tryCatchPattern":"id, err := spin.AccountID(\"prod\")\nif err != nil {\n\t// err text is Spinnaker's own \"error\" field; log it and skip/abort gracefully\n\tlog.Printf(\"AccountID failed: %v\", err)\n\treturn err\n}","preventionTips":["Ensure account names in chaosmonkey config exactly match Spinnaker account names","Validate TLS client cert auth works before production runs","Monitor Spinnaker/clouddriver health and versions","Handle non-fatal account errors by skipping affected apps"],"tags":["http","api","spinnaker"],"backgroundTag":"upstream-api-error-response","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"}