{"record":{"id":"bab82ffae78b3628","repo":"hashicorp/nomad","slug":"consul-linked-service-requires-name","errorCode":null,"errorMessage":"Consul Linked Service requires Name","messagePattern":"Consul Linked Service requires Name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/services.go","lineNumber":2633,"sourceCode":"\t\treturn false\n\tcase s.CertFile != o.CertFile:\n\t\treturn false\n\tcase s.KeyFile != o.KeyFile:\n\t\treturn false\n\tcase s.SNI != o.SNI:\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nfunc (s *ConsulLinkedService) Validate() error {\n\tif s == nil {\n\t\treturn nil\n\t}\n\n\tif s.Name == \"\" {\n\t\treturn fmt.Errorf(\"Consul Linked Service requires Name\")\n\t}\n\n\tcaSet := s.CAFile != \"\"\n\tcertSet := s.CertFile != \"\"\n\tkeySet := s.KeyFile != \"\"\n\tsniSet := s.SNI != \"\"\n\n\tif (certSet || keySet) && !caSet {\n\t\treturn fmt.Errorf(\"Consul Linked Service TLS requires CAFile\")\n\t}\n\n\tif certSet != keySet {\n\t\treturn fmt.Errorf(\"Consul Linked Service TLS Cert and Key must both be set\")\n\t}\n\n\tif sniSet && !caSet {\n\t\treturn fmt.Errorf(\"Consul Linked Service TLS SNI requires CAFile\")\n\t}","sourceCodeStart":2615,"sourceCodeEnd":2651,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/services.go#L2615-L2651","documentation":"ConsulLinkedService.Validate found an empty Name on a linked service in a terminating gateway (or ingress TLS-linked) config. The name identifies the Consul service the gateway proxies to and is mandatory.","triggerScenarios":"Thrown at nomad/structs/services.go:2633 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the name of the Consul service to link in each service block"],"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"}