Netflix/chaosmonkey · error

retrieve cloud provider failed

Error message

retrieve cloud provider failed

What it means

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.

Source

Thrown at eligible/eligible.go:189

		if region == string(r) {
			return true
		}
	}
	return false
}

const whiteListErrorMessage = "whitelist is not supported"

// isWhiteList returns true if an error is related to a whitelist
func isWhitelist(err error) bool {
	return err.Error() == whiteListErrorMessage
}

// Instances returns instances eligible for termination
func Instances(group grp.InstanceGroup, exs []chaosmonkey.Exception, dep deploy.Deployment) ([]chaosmonkey.Instance, error) {
	cloudProvider, err := dep.CloudProvider(group.Account())
	if err != nil {
		return nil, errors.Wrap(err, "retrieve cloud provider failed")
	}

	cls, err := clusters(group, deploy.CloudProvider(cloudProvider), exs, dep)
	if err != nil {
		return nil, err
	}

	result := make([]chaosmonkey.Instance, 0)

	for _, cl := range cls {
		instances, err := getInstances(cl, dep)
		if err != nil {
			return nil, err
		}
		result = append(result, instances...)

	}
	return result, nil

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Inspect the wrapped cause (%+v of the returned error) to see the underlying CloudProvider error for the account
  2. Verify group.Account() matches an account configured in the cloud provider deployment implementation
  3. Ensure the deployment's CloudProvider implementation is registered/initialized before Instances is called
  4. Test dep.CloudProvider(group.Account()) directly in isolation to reproduce the failure

Example fix

// before
cp, err := dep.CloudProvider(group.Account())
// after (guard before calling Instances)
cp, err := dep.CloudProvider(group.Account())
if err != nil {
    log.Printf("cloud provider unavailable for account %s: %v", account, err)
    return
}
Defensive patterns

Strategy: validation

Validate before calling

cp, err := dep.CloudProvider(group.Account())
if err != nil {
    return fmt.Errorf("cannot run eligibility for account %q: %w", group.Account(), err)
}

Try / catch

if _, err := eligible.Instances(grp, exs, dep); err != nil {
    var wrapped *errors.wrapError
    if stderrors.As(err, &wrapped) {
        log.Printf("cloud provider retrieval failed: %+v", err)
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Netflix/chaosmonkey@eaa28fb761 (2026-09-03). Data as JSON: /api/errors/113bc97cd6802627. Report an issue: GitHub.