{"record":{"id":"41bb2034330e9b9b","repo":"hashicorp/nomad","slug":"failed-to-initialize-consul-client-config-v","errorCode":null,"errorMessage":"failed to initialize Consul client config: %v","messagePattern":"failed to initialize Consul client config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/fingerprint/consul.go","lineNumber":183,"sourceCode":"func (f *ConsulFingerprint) Periodic() (bool, time.Duration) {\n\treturn true, 15 * time.Second\n}\n\n// Reload satisfies ReloadableFingerprint and resets the gate on periodic\n// fingerprinting.\nfunc (f *ConsulFingerprint) Reload() {\n\tf.setInitialResponse(nil)\n}\n\nfunc (cfs *consulState) initialize(cfg *config.ConsulConfig, logger hclog.Logger) error {\n\tcfs.fingerprintedOnce = false\n\tif cfs.client != nil {\n\t\treturn nil // already initialized!\n\t}\n\n\tconsulConfig, err := cfg.ApiConfig()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to initialize Consul client config: %v\", err)\n\t}\n\n\tcfs.client, err = consulapi.NewClient(consulConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to initialize Consul client: %v\", err)\n\t}\n\n\tif cfg.Name == structs.ConsulDefaultCluster {\n\t\tcfs.readers = map[string]valueReader{\n\t\t\t\"consul.server\":          cfs.server,\n\t\t\t\"consul.version\":         cfs.version,\n\t\t\t\"consul.sku\":             cfs.sku,\n\t\t\t\"consul.revision\":        cfs.revision,\n\t\t\t\"unique.consul.name\":     cfs.name, // note: won't have this for non-default clusters\n\t\t\t\"consul.datacenter\":      cfs.dc,\n\t\t\t\"consul.segment\":         cfs.segment,\n\t\t\t\"consul.connect\":         cfs.connect,\n\t\t\t\"consul.grpc\":            cfs.grpc(consulConfig.Scheme, logger),","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/fingerprint/consul.go#L165-L201","documentation":"The Consul fingerprinter builds a Consul API client config from the Nomad agent's Consul configuration block. cfg.ApiConfig() (in client/config) validates and translates that config into an *api.Config; when that translation fails — e.g. invalid address or TLS material — the fingerprinter returns this error and the Consul fingerprint fails.","triggerScenarios":"Invalid consul.address (unparseable host:port, bad scheme), invalid TLS cert/key/CA file paths, or invalid CA/verify settings in the agent's consul block.","commonSituations":"Typo in consul.address; TLS keypair files missing/misnamed; enabling https with bad certificates; invalid ACL token format; Unix socket path syntax mistakes.","solutions":["Fix the consul.address in the Nomad agent config (check scheme and host:port format)","Verify all consul.tls cert/key/ca_file paths exist and are readable","Run consul validate / test the same address with curl or consul members","Check Nomad agent startup logs for the underlying ApiConfig validation detail"],"exampleFix":"// before\nconsul {\n  address = \"consul.service.internal\" // missing port\n}\n// after\nconsul {\n  address = \"127.0.0.1:8500\"\n}","handlingStrategy":"validation","validationCode":"addr := cfg.Consul.Address\nif _, _, err := net.SplitHostPort(addr); err != nil && !strings.HasPrefix(addr, \"unix://\") {\n    return fmt.Errorf(\"invalid consul address %q\", addr)\n}\nfor _, p := range []string{cfg.Consul.TLS.CertFile, cfg.Consul.TLS.KeyFile, cfg.Consul.TLS.CAFile} {\n    if p != \"\" { if _, err := os.Stat(p); err != nil { return fmt.Errorf(\"consul tls file missing: %s\", p) } }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test the consul address with consul members or curl from the host","Keep TLS material paths stable and managed by config tooling","Validate the full agent config with nomad agent -config-check before deploy"],"tags":["consul","configuration","tls"],"backgroundTag":"consul-client-config-invalid","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"}