{"record":{"id":"09ca49199d89034d","repo":"hashicorp/nomad","slug":"consul-address-must-be-set-on-nomad-client","errorCode":null,"errorMessage":"consul address must be set on nomad client","messagePattern":"consul address must be set on nomad client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/consul_http_sock_hook.go","lineNumber":213,"sourceCode":"\tif p.runOnce {\n\t\treturn nil\n\t}\n\n\t// Never restart.\n\tselect {\n\tcase <-p.doneCh:\n\t\tp.logger.Trace(\"consul http socket proxy already shutdown; exiting\")\n\t\treturn nil\n\tcase <-p.ctx.Done():\n\t\tp.logger.Trace(\"consul http socket proxy already done; exiting\")\n\t\treturn nil\n\tdefault:\n\t}\n\n\t// consul http dest addr\n\tdestAddr := p.config.Addr\n\tif destAddr == \"\" {\n\t\treturn errors.New(\"consul address must be set on nomad client\")\n\t}\n\n\tsocketFile := allocdir.AllocHTTPSocket\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+\"_http.sock\")\n\t}\n\thostHTTPSockPath := filepath.Join(p.allocDir.AllocDirPath(), socketFile)\n\tif err := maybeRemoveOldSocket(hostHTTPSockPath); err != nil {\n\t\treturn err\n\t}\n\n\tlistener, err := net.Listen(\"unix\", hostHTTPSockPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create unix socket for Consul HTTP endpoint: %w\", err)\n\t}\n\n\t// The Consul HTTP socket should be usable by all users in case a task is","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/consul_http_sock_hook.go#L195-L231","documentation":"The Consul HTTP socket hook builds a proxy from the allocation's netns to the Consul HTTP address. The destination address comes from the Nomad client's resolved Consul config (p.config.Addr). If that address is empty — i.e., the client has no Consul address configured — run() aborts with this error since there is no destination to proxy to.","triggerScenarios":"Starting a Connect-enabled allocation on a Nomad client whose consul.address (or auto-discovered address) is empty — e.g. consul block omitted/empty in client config while the task still requires the Consul HTTP socket proxy.","commonSituations":"Clients with an empty/omitted consul stanza but a group Connect service block; broken Consul auto-discovery on the client; environments where Consul runs elsewhere and the address was never propagated into the hook config.","solutions":["Set address in the client's consul config block (e.g. consul { address = \"127.0.0.1:8500\" }) and restart the Nomad client","Ensure the client's Consul auto-discovery resolves (fix Consul agent discovery/fingerprints)","Remove the Connect service block from the job if Consul is not actually used on that client","Schedule Connect workloads only onto clients with a valid Consul address (use node metadata/constraints)"],"exampleFix":"// before (client config)\nconsul {}\n// after\nconsul {\n  address = \"127.0.0.1:8500\"\n}","handlingStrategy":"validation","validationCode":"// verify the client has a Consul address before scheduling Connect work\ncfg, err := client.Agent().Self()\nif err != nil { return err }\naddr, _ := cfg.Config[\"DebugConfig\"].(map[string]interface{})[\"ConsulAddress\"].(string)\nif addr == \"\" { return errors.New(\"client has no consul address; Connect workloads will fail\") }","typeGuard":null,"tryCatchPattern":"if err := p.run(); err != nil {\n  if err.Error() == \"consul address must be set on nomad client\" {\n    return fmt.Errorf(\"cannot proxy consul for alloc: configure consul.address on the nomad client: %w\", err)\n  }\n  return err\n}","preventionTips":["Always configure consul.address on clients that will run Connect (group service) workloads","Add constraints/node metadata so Connect jobs only land on Consul-configured clients","Verify client Consul discovery/health during provisioning","Fail fast in CI by checking agent config before deploying Connect jobs"],"tags":["consul","connect","configuration","service-mesh"],"backgroundTag":"missing-config-value","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"}