{"record":{"id":"c4277deb1b16acb9","repo":"hashicorp/nomad","slug":"consul-linked-service-tls-cert-and-key-must-both-b","errorCode":null,"errorMessage":"Consul Linked Service TLS Cert and Key must both be set","messagePattern":"Consul Linked Service TLS Cert and Key must both be set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/services.go","lineNumber":2646,"sourceCode":"\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}\n\n\treturn nil\n}\n\nfunc linkedServicesEqual(a, b []*ConsulLinkedService) bool {\n\treturn helper.ElementsEqual(a, b)\n}\n\ntype ConsulTerminatingConfigEntry struct {\n\tServices []*ConsulLinkedService\n}\n\nfunc (e *ConsulTerminatingConfigEntry) Copy() *ConsulTerminatingConfigEntry {","sourceCodeStart":2628,"sourceCodeEnd":2664,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/services.go#L2628-L2664","documentation":"ConsulLinkedService.Validate: exactly one of cert_file/key_file was set on a linked service. Client certificates must be supplied as a pair, so setting only one is rejected.","triggerScenarios":"Thrown at nomad/structs/services.go:2646 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set both cert_file and key_file","Remove both if no client certificate is needed"],"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"}