{"record":{"id":"113bc97cd6802627","repo":"Netflix/chaosmonkey","slug":"retrieve-cloud-provider-failed","errorCode":null,"errorMessage":"retrieve cloud provider failed","messagePattern":"retrieve cloud provider failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"eligible/eligible.go","lineNumber":189,"sourceCode":"\t\tif region == string(r) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nconst whiteListErrorMessage = \"whitelist is not supported\"\n\n// isWhiteList returns true if an error is related to a whitelist\nfunc isWhitelist(err error) bool {\n\treturn err.Error() == whiteListErrorMessage\n}\n\n// Instances returns instances eligible for termination\nfunc Instances(group grp.InstanceGroup, exs []chaosmonkey.Exception, dep deploy.Deployment) ([]chaosmonkey.Instance, error) {\n\tcloudProvider, err := dep.CloudProvider(group.Account())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"retrieve cloud provider failed\")\n\t}\n\n\tcls, err := clusters(group, deploy.CloudProvider(cloudProvider), exs, dep)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := make([]chaosmonkey.Instance, 0)\n\n\tfor _, cl := range cls {\n\t\tinstances, err := getInstances(cl, dep)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult = append(result, instances...)\n\n\t}\n\treturn result, nil","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/eligible/eligible.go#L171-L207","documentation":"Instances() resolves the cloud provider for the account of the instance group being considered for termination. It calls dep.CloudProvider(group.Account()) and wraps any failure with 'retrieve cloud provider failed'. This means the deployment interface could not produce a cloud provider client for that account, so eligibility checks cannot proceed.","triggerScenarios":"dep.CloudProvider(account) returns a non-nil error — e.g. the configured cloud provider cannot be instantiated for the account name on the instance group, the deployment implementation does not recognize the account, or its underlying credentials/config lookup fails.","commonSituations":"Misconfigured or missing account name in the instance group; cloud provider factory not registered or map lookup failing for the account; stale credentials/region config for the account in the deployment layer; running the monkey against an account the cloud provider integration does not support.","solutions":["Inspect the wrapped cause (%+v of the returned error) to see the underlying CloudProvider error for the account","Verify group.Account() matches an account configured in the cloud provider deployment implementation","Ensure the deployment's CloudProvider implementation is registered/initialized before Instances is called","Test dep.CloudProvider(group.Account()) directly in isolation to reproduce the failure"],"exampleFix":"// before\ncp, err := dep.CloudProvider(group.Account())\n// after (guard before calling Instances)\ncp, err := dep.CloudProvider(group.Account())\nif err != nil {\n    log.Printf(\"cloud provider unavailable for account %s: %v\", account, err)\n    return\n}","handlingStrategy":"validation","validationCode":"cp, err := dep.CloudProvider(group.Account())\nif err != nil {\n    return fmt.Errorf(\"cannot run eligibility for account %q: %w\", group.Account(), err)\n}","typeGuard":null,"tryCatchPattern":"if _, err := eligible.Instances(grp, exs, dep); err != nil {\n    var wrapped *errors.wrapError\n    if stderrors.As(err, &wrapped) {\n        log.Printf(\"cloud provider retrieval failed: %+v\", err)\n    }\n}","preventionTips":["Validate account names against the cloud provider registry at startup","Log errors with %+v to preserve the wrapped cause chain","Add an integration test that resolves a cloud provider for every configured account"],"tags":["go","cloud-provider","configuration","error-wrapping"],"backgroundTag":"cloud-provider-resolution-failed","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"}