{"record":{"id":"e1f2332aa38f4be7","repo":"rqlite/rqlite","slug":"failed-to-start-discovery-service-s","errorCode":null,"errorMessage":"failed to start discovery service: %s","messagePattern":"failed to start discovery service: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cmd/rqlited/main.go","lineNumber":696,"sourceCode":"\t\t\tprovider = dns.NewWithPort(dnsCfg, cfg.RaftPort())\n\n\t\t} else {\n\t\t\tdnssrvCfg, err := dnssrv.NewConfigFromReader(rc)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error reading DNS configuration: %s\", err.Error())\n\t\t\t}\n\t\t\tprovider = dnssrv.New(dnssrvCfg)\n\t\t}\n\n\t\tbs := cluster.NewBootstrapper(provider, client)\n\t\tbs.SetCredentials(cluster.CredentialsFor(credStr, cfg.JoinAs))\n\t\thttpServ.RegisterStatus(\"disco\", provider)\n\t\treturn bs.Boot(ctx, str.ID(), cfg.RaftAdv, clusterSuf, bootDoneFn, cfg.BootstrapExpectTimeout)\n\n\tcase DiscoModeEtcdKV, DiscoModeConsulKV:\n\t\tdiscoService, err := createDiscoService(cfg, str)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to start discovery service: %s\", err.Error())\n\t\t}\n\t\t// Safe to start reporting before doing registration. If the node hasn't bootstrapped\n\t\t// yet, or isn't leader, reporting will just be a no-op until something changes.\n\t\tgo discoService.StartReporting(cfg.NodeID, cfg.HTTPURL(), cfg.RaftAdv)\n\t\thttpServ.RegisterStatus(\"disco\", discoService)\n\n\t\tif hasPeers {\n\t\t\tlog.Printf(\"preexisting node configuration detected, not registering with discovery service\")\n\t\t\treturn nil\n\t\t}\n\t\tlog.Println(\"no preexisting nodes, registering with discovery service\")\n\n\t\tleader, addr, err := discoService.Register(str.ID(), cfg.HTTPURL(), cfg.RaftAdv)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to register with discovery service: %s\", err.Error())\n\t\t}\n\t\tif leader {\n\t\t\tlog.Println(\"node registered as leader using discovery service\")","sourceCodeStart":678,"sourceCodeEnd":714,"githubUrl":"https://github.com/rqlite/rqlite/blob/7586a4d1bdbd9a5a80021664c5a863cd850adb60/cmd/rqlited/main.go#L678-L714","documentation":"When -disco-mode is consul-kv or etcd-kv, rqlited builds a discovery service client via createDiscoService. If that construction fails (bad endpoint, credentials, or client initialization error), node startup aborts with this message. The discovery service is required for the node to find/register with the cluster, so rqlited refuses to continue in a degraded state.","triggerScenarios":"Running with -disco-mode consul-kv or etcd-kv when createDiscoService returns an error: unreachable or malformed Consul/Etcd endpoint, missing API key/credentials, unsupported scheme, or constructor failure inside the disco package.","commonSituations":"Consul/Etcd not running or wrong host:port configured; network/firewall blocking the KV store; expired or invalid ACL token; typo in -disco-config endpoint.","solutions":["Verify the Consul/Etcd endpoint in the disco config is correct and reachable (curl the health endpoint).","Check credentials/ACL tokens configured for the KV store are valid and not expired.","Start the discovery service or switch to another clustering method (explicit -join addresses or DNS discovery)."],"exampleFix":"// before\nrqlited -disco-mode consul-kv -disco-config consul.cfg   # consul at wrong host\n// after\nrqlited -disco-mode consul-kv -disco-config consul.cfg   # config points to http://127.0.0.1:8500, consul running","handlingStrategy":"validation","validationCode":"conn, err := net.DialTimeout(\"tcp\", consulHostPort, 2*time.Second)\nif err != nil {\n    return fmt.Errorf(\"discovery service unreachable at %s: %v\", consulHostPort, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-flight check the Consul/Etcd endpoint reachability before starting rqlited.","Validate ACL tokens with a CLI query (consul kv get / etcdctl get) before node launch.","Pin discovery endpoints in config management, not ad-hoc flags."],"tags":["startup","discovery","consul","etcd","network"],"backgroundTag":"discovery-service-unavailable","analyzedSha":"7586a4d1bdbd9a5a80021664c5a863cd850adb60","analyzedAt":"2026-09-03T07:03:02.260Z","contentChangedAt":"2026-09-03T07:03:02.260Z","schemaVersion":2},"datasetVersion":"2026-09-10T12:17:11.382Z"}