{"record":{"id":"cfc615ee79910177","repo":"rqlite/rqlite","slug":"raft-bind-address-not-valid","errorCode":null,"errorMessage":"raft bind address not valid","messagePattern":"raft bind address not valid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/rqlited/flags.go","lineNumber":128,"sourceCode":"\tif strings.HasPrefix(strings.ToLower(c.HTTPAddr), \"http\") ||\n\t\tstrings.HasPrefix(strings.ToLower(c.HTTPAdv), \"http\") {\n\t\treturn errors.New(\"HTTP options should not include protocol (http:// or https://)\")\n\t}\n\tif _, _, err := net.SplitHostPort(c.HTTPAddr); err != nil {\n\t\treturn errors.New(\"HTTP bind address not valid\")\n\t}\n\n\thadv, _, err := net.SplitHostPort(c.HTTPAdv)\n\tif err != nil {\n\t\treturn errors.New(\"HTTP advertised HTTP address not valid\")\n\t}\n\tif addr := net.ParseIP(hadv); addr != nil && addr.IsUnspecified() {\n\t\treturn fmt.Errorf(\"advertised HTTP address is not routable (%s), specify it via -%s or -%s\",\n\t\t\thadv, HTTPAddrFlag, HTTPAdvAddrFlag)\n\t}\n\n\tif _, rp, err := net.SplitHostPort(c.RaftAddr); err != nil {\n\t\treturn errors.New(\"raft bind address not valid\")\n\t} else if _, err := strconv.Atoi(rp); err != nil {\n\t\treturn errors.New(\"raft bind port not valid\")\n\t}\n\n\tradv, rp, err := net.SplitHostPort(c.RaftAdv)\n\tif err != nil {\n\t\treturn errors.New(\"raft advertised address not valid\")\n\t}\n\tif addr := net.ParseIP(radv); addr != nil && addr.IsUnspecified() {\n\t\treturn fmt.Errorf(\"advertised Raft address is not routable (%s), specify it via -%s or -%s\",\n\t\t\tradv, RaftAddrFlag, RaftAdvAddrFlag)\n\t}\n\tif _, err := strconv.Atoi(rp); err != nil {\n\t\treturn errors.New(\"raft advertised port is not valid\")\n\t}\n\n\tif c.RaftAdv == c.HTTPAdv {\n\t\treturn errors.New(\"advertised HTTP and Raft addresses must differ\")","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/rqlite/rqlite/blob/7586a4d1bdbd9a5a80021664c5a863cd850adb60/cmd/rqlited/flags.go#L110-L146","documentation":"Config.Validate (cmd/rqlited/flags.go:128) applies net.SplitHostPort to -raft-addr; a parse failure yields this error, while a non-numeric port yields the related 'raft bind port not valid'. The Raft bind address must be a valid host:port since the Raft layer listens there.","triggerScenarios":"Starting rqlited with -raft-addr missing its port, malformed, or containing a scheme like raft://host:port.","commonSituations":"Forgetting the port (e.g. -raft-addr=localhost); using a named service port instead of a number; copy-pasting a URL into the address flag.","solutions":["Provide a full host:port value, e.g. -raft-addr=localhost:4002","Ensure the port is numeric","Bracket IPv6 hosts, e.g. -raft-addr=[::1]:4002"],"exampleFix":"// before\nrqlited -raft-addr=raft://localhost:4002\n// after\nrqlited -raft-addr=localhost:4002","handlingStrategy":"validation","validationCode":"_, port, err := net.SplitHostPort(raftAddr)\nif err != nil {\n    return fmt.Errorf(\"-raft-addr must be host:port, got %q\", raftAddr)\n}\nif _, err := strconv.Atoi(port); err != nil {\n    return fmt.Errorf(\"raft bind port must be numeric, got %q\", port)\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.Validate(); err != nil {\n    log.Fatalf(\"invalid flags: %v\", err)\n}","preventionTips":["Always pass numeric host:port for -raft-addr; no schemes or named ports","Bracket IPv6 literals and strip any raft:// prefix","Validate address flags in scripts with net.SplitHostPort before launching"],"tags":["network","configuration","address-validation"],"backgroundTag":"invalid-bind-address","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"}