{"record":{"id":"ce7c3a910a0b2484","repo":"hashicorp/nomad","slug":"envoy-must-be-configured-with-a-service-name","errorCode":null,"errorMessage":"envoy must be configured with a service name","messagePattern":"envoy must be configured with a service name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/envoy_bootstrap_hook.go","lineNumber":231,"sourceCode":"\tcase structs.ConnectTerminatingPrefix:\n\t\treturn true\n\tcase structs.ConnectMeshPrefix:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\nfunc (_ *envoyBootstrapHook) extractNameAndKind(kind structs.TaskKind) (string, string, error) {\n\tserviceName := kind.Value()\n\tserviceKind := kind.Name()\n\n\tif !isConnectKind(serviceKind) {\n\t\treturn \"\", \"\", errors.New(\"envoy must be used as connect sidecar or gateway\")\n\t}\n\n\tif serviceName == \"\" {\n\t\treturn \"\", \"\", errors.New(\"envoy must be configured with a service name\")\n\t}\n\n\treturn serviceKind, serviceName, nil\n}\n\nfunc (h *envoyBootstrapHook) lookupService(svcKind, svcName string, taskEnv *taskenv.TaskEnv) (*structs.Service, error) {\n\ttg := h.alloc.Job.LookupTaskGroup(h.alloc.TaskGroup)\n\tinterpolatedServices := taskenv.InterpolateServices(taskEnv, tg.Services)\n\n\tvar service *structs.Service\n\tfor _, s := range interpolatedServices {\n\t\tif s.Name == svcName {\n\t\t\tservice = s\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif service == nil {","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/envoy_bootstrap_hook.go#L213-L249","documentation":"Fired in envoyBootstrapHook.extractNameAndKind during Prestart when a task kind is a valid connect kind (connect sidecar or gateway) but its value — the service name — is empty, e.g. a connect sidecar task declared without an interpolated/empty service name.","triggerScenarios":"Thrown at client/allocrunner/taskrunner/envoy_bootstrap_hook.go:231 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the connect sidecar/gateway task's kind value to the target service name (e.g. kind = \"connect-proxy:my-service\")","Verify variable interpolation in the task kind did not resolve to an empty string"],"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"}