Netflix/chaosmonkey · error

failed viper.AddRemoteProvider(provider="%s", endpoint="%s",

Error message

failed viper.AddRemoteProvider(provider="%s", endpoint="%s", path="%s"):

What it means

Returned by Monkey.configureRemote when viper rejects the dynamic-config provider registration, e.g. an unsupported provider name or conflicting duplicate provider; the provider, endpoint and path in the message identify which dynamic-config settings are at fault.

Source

Thrown at config/monkey.go:164

	return m, nil

}

// configureRemote configures viper for a remote provider if the user has
// specified one
func (m *Monkey) configureRemote() error {
	provider := m.v.GetString(param.DynamicProvider)
	endpoint := m.v.GetString(param.DynamicEndpoint)
	path := m.v.GetString(param.DynamicPath)

	// If the user specified an external provider, use it
	if provider != "" {
		m.remote = true
		m.v.SetConfigType("json")
		err := m.v.AddRemoteProvider(provider, endpoint, path)
		if err != nil {
			return errors.Wrapf(err, "failed viper.AddRemoteProvider(provider=\"%s\", endpoint=\"%s\", path=\"%s\"):", provider, endpoint, path)
		}
	}
	return nil
}

// SetRemoteProvider sets remote configuration parameters.
// These will typically be set by parsing the config files. This method
// exists to facilitate testing
func (m *Monkey) SetRemoteProvider(provider string, endpoint string, path string) error {
	m.v.Set(param.DynamicProvider, provider)
	m.v.Set(param.DynamicEndpoint, endpoint)
	m.v.Set(param.DynamicPath, path)

	return m.configureRemote()
}

// Set overrides the config value. Used for testing
func (m *Monkey) Set(key string, value interface{}) {

View on GitHub (pinned to eaa28fb761)

Solutions

  1. Use a supported provider string exactly: "consul", "etcd", or "firestore"
  2. Ensure the endpoint is a full URL like "http://127.0.0.1:8500"
  3. Verify provider/endpoint/path are all set consistently before calling SetRemoteProvider
  4. Check the wrapped viper error for the specific validation failure

Example fix

// before
m.SetRemoteProvider("Consul", "127.0.0.1:8500", "chaosmonkey/config")
// after
m.SetRemoteProvider("consul", "http://127.0.0.1:8500", "chaosmonkey/config")
Defensive patterns

Strategy: validation

Validate before calling

var validProviders = map[string]bool{"consul": true, "etcd": true, "firestore": true}
if provider != "" && !validProviders[provider] {
    return fmt.Errorf("unsupported remote provider %q; use consul, etcd, or firestore", provider)
}
if provider != "" && !strings.Contains(endpoint, "://") {
    return fmt.Errorf("endpoint must be a full URL, got %q", endpoint)
}

Try / catch

if err := m.SetRemoteProvider(provider, endpoint, path); err != nil {
    log.Printf("remote provider setup failed: %v", errors.Unwrap(err))
    return err
}

Prevention

When it happens

Trigger: Setting a remote provider via Load, NewFromReader, or SetRemoteProvider with an unsupported provider name, malformed endpoint URL, or invalid path.

Common situations: Provider name typo (e.g. "Consul" instead of "consul"), missing scheme in the endpoint, remote config feature enabled without required params.

Related errors


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