OpenNHP/opennhp · error

unknown remote provider

Error message

unknown remote provider

What it means

Identical guard to the AC's initRemoteConn but in UdpServer: when the configured remote provider is not the supported one (etcd), Start() fails with this sentinel error before the server can load remote base config.

Solutions

  1. Set the remote provider field to the supported value (etcd) in the server config
  2. Check the rendered config on the host for empty/unsubstituted provider values
  3. Remove the remote config block if remote config is not intended
  4. Log the received provider value when extending the switch to catch future typos

Example fix

// before (config.toml)
[remote]
provider = ""
// after
[remote]
provider = "etcd"
Defensive patterns

Strategy: validation

Validate before calling

if s.conf.Remote.Provider != "etcd" {
    return fmt.Errorf("server config: unsupported remote provider %q", s.conf.Remote.Provider)
}

Type guard

func isValidRemoteProvider(p string) bool { return p == "etcd" }

Try / catch

err := s.Start()
if err != nil && err.Error() == "unknown remote provider" {
    log.Fatalf("check [remote] provider in server config: %v", err)
}

Prevention

When it happens

Trigger: Start() -> initRemoteConn runs while the server config's remote provider value is empty or not the supported 'etcd' string.

Common situations: Mis-edited config.toml, templating variable left unsubstituted (e.g. ${REMOTE_PROVIDER}), or copying a config from a project using a different provider such as consul.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of OpenNHP/opennhp@6e04ca5ff0 (2026-09-07). Data as JSON: /api/errors/710c5def21fb857a. Report an issue: GitHub.

Appendix: source

Thrown at endpoints/server/config.go:482

			return nil
		}

		if len(conf.Key) == 0 {
			log.Error("remote config has no key,open nhp server will startup with local configuration")
			return nil
		}

		s.etcdConn = &etcd.EtcdConn{
			Endpoints: conf.Endpoints,
			Username:  conf.Username,
			Password:  conf.Password,
			Key:       conf.Key,
		}

		err = s.etcdConn.InitClient()
		return err
	} else {
		return errors.New("unknown remote provider")
	}

}

func (s *UdpServer) loadRemoteBaseConfig() error {
	var serverEtcdConfig ServerEtcdConfig
	value, err := s.etcdConn.GetValue()
	if err != nil {
		return err
	}
	if err = toml.Unmarshal(value, &serverEtcdConfig); err != nil {
		log.Error("failed to unmarshal remote config: %v", err)
		return err
	}

	err = s.updateBaseConfig(serverEtcdConfig.BaseConfig)
	return err
}

View on GitHub (pinned to 6e04ca5ff0)