{"record":{"id":"1a9664297b2fe355","repo":"hashicorp/nomad","slug":"error-parsing-consul-address-q-v","errorCode":null,"errorMessage":"error parsing Consul address %q: %v","messagePattern":"error parsing Consul address %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/consul_grpc_sock_hook.go","lineNumber":258,"sourceCode":"\t\tp.logger.Trace(\"socket proxy already done; exiting\")\n\t\treturn nil\n\tdefault:\n\t}\n\n\t// make sure either grpc or http consul address has been configured\n\tif p.config.GRPCAddr == \"\" && p.config.Addr == \"\" {\n\t\treturn fmt.Errorf(\"consul address for cluster %q must be set on nomad client\",\n\t\t\tp.config.Name)\n\t}\n\n\tdestAddr := p.config.GRPCAddr\n\n\tif destAddr == \"\" {\n\t\t// No GRPCAddr defined. Use Addr but replace port with the gRPC\n\t\t// default of 8502.\n\t\thost, _, err := net.SplitHostPort(p.config.Addr)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error parsing Consul address %q: %v\", p.config.Addr, err)\n\t\t}\n\t\tdestAddr = net.JoinHostPort(host, p.consulGRPCFallbackPort)\n\t} else {\n\t\t// GRPCAddr may be sockaddr/template string, parse it.\n\t\tipStr, err := listenerutil.ParseSingleIPTemplate(destAddr)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to parse address template %q: %v\", destAddr, err)\n\t\t}\n\t\tdestAddr = ipStr\n\t}\n\n\tsocketFile := allocdir.AllocGRPCSocket\n\tif p.config.Name != structs.ConsulDefaultCluster && p.config.Name != \"\" {\n\t\tsocketFile = filepath.Join(allocdir.SharedAllocName, allocdir.TmpDirName,\n\t\t\t\"consul_\"+p.config.Name+\"_grpc.sock\")\n\t}\n\thostGRPCSocketPath := filepath.Join(p.allocDir.AllocDirPath(), socketFile)\n","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/consul_grpc_sock_hook.go#L240-L276","documentation":"When no dedicated GRPCAddr is set, the proxy derives one from Addr by replacing the port with 8502; net.SplitHostPort failed on the configured Consul address (malformed host:port), so run aborts with the parse error wrapped.","triggerScenarios":"Thrown at client/allocrunner/consul_grpc_sock_hook.go:258 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the consul address in client config to a valid host:port form","Check for missing port or stray characters in the address","Set an explicit grpc address to bypass the fallback path"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}