t8y2/dbx · error
namesrv_addr is required
Error message
namesrv_addr is required
What it means
parseConnection requires at least one name server address to build a RocketMQ connection; without a namesrv_addr the client cannot discover the cluster topology. splitAddresses is run on 'namesrv_addr' (or camelCase 'namesrvAddr') and the error fires when the resulting list is empty.
Source
Thrown at agents/drivers/rocketmq/connection.go:43
NameServers []string
ClusterName string
BrokerAddr string
AccessKey string
SecretKey string
RequestTimeout time.Duration
ConnectTimeout time.Duration
TLSSkipVerify bool
SocksProxy *socksProxyConfig
}
func parseConnection(params map[string]any) (connectionConfig, error) {
connection := nestedMap(params, "connection")
if connection == nil {
connection = params
}
nameServers := splitAddresses(stringValue(connection, "namesrv_addr", "namesrvAddr"))
if len(nameServers) == 0 {
return connectionConfig{}, fmt.Errorf("namesrv_addr is required")
}
config := connectionConfig{
NameServers: nameServers,
ClusterName: stringValue(connection, "cluster_name", "clusterName"),
BrokerAddr: stringValue(connection, "broker_addr", "brokerAddr"),
AccessKey: stringValue(connection, "access_key", "accessKey"),
SecretKey: stringValue(connection, "secret_key", "secretKey"),
RequestTimeout: time.Duration(intValue(connection, int(defaultRequestTimeout/time.Millisecond), "request_timeout_ms")) * time.Millisecond,
ConnectTimeout: time.Duration(intValue(connection, int(defaultConnectTimeout/time.Millisecond), "connect_timeout_ms")) * time.Millisecond,
TLSSkipVerify: boolValue(connection, false, "tls_skip_verify"),
}
if config.RequestTimeout <= 0 {
config.RequestTimeout = defaultRequestTimeout
}
if config.ConnectTimeout <= 0 {
config.ConnectTimeout = defaultConnectTimeout
}
if proxy := nestedMap(connection, "socks_proxy"); proxy != nil {View on GitHub (pinned to c0390bff16)
Solutions
- Set 'namesrv_addr' (or 'namesrvAddr') in the connection object with one or more comma-separated host:port values
- Verify the environment variable feeding this field is populated and non-empty at runtime
- If you only have a broker address, point namesrv_addr at the name server(s) of the same cluster
Example fix
// before
{"connection": {"access_key": "ak"}}
// after
{"connection": {"namesrv_addr": "11.0.0.1:9876,11.0.0.2:9876", "access_key": "ak"}} Defensive patterns
Strategy: validation
Validate before calling
ns := cfg.Connection["namesrv_addr"]
if len(strings.Split(fmt.Sprint(ns), ",")) == 0 || strings.TrimSpace(fmt.Sprint(ns)) == "" {
return errors.New("namesrv_addr must contain at least one host:port")
} Type guard
func hasNameServers(conn map[string]any) bool {
v := stringValue(conn, "namesrv_addr", "namesrvAddr")
return len(splitAddresses(v)) > 0
} Try / catch
conn, err := parseConnection(params)
if err != nil {
var missing = "namesrv_addr is required"
if err.Error() == missing { log.Fatal("set ROCKETMQ_NAMESRV_ADDR env var") }
return err
} Prevention
- Set namesrv_addr via environment with a startup sanity check
- Prefer providing comma-separated name servers for HA
- Don't assume broker_addr can replace name servers
When it happens
Trigger: connect/testConnection called with connection params that omit 'namesrv_addr', use an alternate wrong key, or pass an empty/whitespace-only value.
Common situations: Env-var interpolation failing so the field resolves to empty; users specifying only broker_addr assuming it substitutes for name servers; mixed casing mistakes between snake_case and camelCase.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- Agent runtime thread limits must be positive
- H2 JDBC driver rejected URL: " + buildJdbcUrl(params)
- Unsupported H2 driver profile: " + profile
- JDBC URL is required.
- BENCH_CANDIDATES selected no candidates
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/f6926c935dbd0be7.
Report an issue: GitHub.