rqlite/rqlite · error
invalid disco mode %s
Error message
invalid disco mode %s
What it means
The -disco-mode flag was set to a value rqlited does not recognize. createCluster's switch over DiscoMode fell through to the default case, which rejects startup. Supported modes are dns, dnssrv, consul-kv, and etcd-kv (plus empty for no discovery).
Source
Thrown at cmd/rqlited/main.go:738
log.Printf("discovery service returned %s as join address", addr)
if j, err := joiner.Do(ctx, []string{addr}, str.ID(), cfg.RaftAdv, clusterSuf); err != nil {
log.Printf("failed to join cluster at %s: %s", addr, err.Error())
time.Sleep(time.Second)
_, addr, err = discoService.Register(str.ID(), cfg.HTTPURL(), cfg.RaftAdv)
if err != nil {
log.Printf("failed to get updated leader: %s", err.Error())
}
continue
} else {
log.Println("successfully joined cluster at", j)
break
}
}
}
default:
return fmt.Errorf("invalid disco mode %s", cfg.DiscoMode)
}
return nil
}
func networkCheckJoinAddrs(joinAddrs []string) error {
if len(joinAddrs) > 0 {
log.Println("checking that supplied join addresses don't serve HTTP(S)")
if addr, ok := httpd.AnyServingHTTP(joinAddrs); ok {
return fmt.Errorf("join address %s appears to be serving HTTP when it should be Raft", addr)
}
}
return nil
}
View on GitHub (pinned to 7586a4d1bd)
Solutions
- Set -disco-mode to one of: dns, dnssrv, consul-kv, etcd-kv (or omit it entirely).
- Check the exact spelling including the -kv suffix for Consul/Etcd modes.
- Consult `rqlited -h` or docs for the list of valid discovery modes in your rqlite version.
Example fix
// before rqlited -disco-mode consul ... // after rqlited -disco-mode consul-kv ...
Defensive patterns
Strategy: validation
Validate before calling
valid := map[string]bool{"": true, "dns": true, "dnssrv": true, "consul-kv": true, "etcd-kv": true}
if !valid[discoMode] {
return fmt.Errorf("-disco-mode %q invalid; use dns, dnssrv, consul-kv, or etcd-kv", discoMode)
} Prevention
- Keep the allowed disco mode list in your deployment tooling and validate flags at deploy time.
- Never hand-type mode names; copy from documentation.
- Run `rqlited -h` to confirm supported modes for your version.
When it happens
Trigger: Starting rqlited with -disco-mode set to any string other than "dns", "dnssrv", "consul-kv", "etcd-kv" or empty — e.g. a typo like "consul" or "etcd".
Common situations: Typo or abbreviation of a mode name; copy-pasting a mode string from another tool; using an old mode name removed in a newer rqlite version.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- data directory path is required
- msg
- -http-verify-common-name requires -http-verify-client
- -node-verify-common-name requires -node-verify-client
- HTTP and Raft addresses must differ
AI-assisted analysis of rqlite/rqlite@7586a4d1bd (2026-09-03).
Data as JSON: /api/errors/c3688660988fd838.
Report an issue: GitHub.