{"record":{"id":"04dc13fd182621a0","repo":"hashicorp/nomad","slug":"connect-gateway-task-exists-but-no-service-associa","errorCode":null,"errorMessage":"connect gateway task exists but no service associated","messagePattern":"connect gateway task exists but no service associated","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/envoy_bootstrap_hook.go","lineNumber":253,"sourceCode":"}\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 {\n\t\tif svcKind == structs.ConnectProxyPrefix {\n\t\t\treturn nil, errors.New(\"connect proxy sidecar task exists but no services configured with a sidecar\")\n\t\t} else {\n\t\t\treturn nil, errors.New(\"connect gateway task exists but no service associated\")\n\t\t}\n\t}\n\n\treturn service, nil\n}\n\n// Prestart creates an envoy bootstrap config file.\n//\n// Must be aware of both launching envoy as a sidecar proxy, as well as a connect gateway.\nfunc (h *envoyBootstrapHook) Prestart(ctx context.Context, req *ifs.TaskPrestartRequest, resp *ifs.TaskPrestartResponse) error {\n\tif !req.Task.Kind.IsConnectProxy() && !req.Task.Kind.IsAnyConnectGateway() {\n\t\treturn nil\n\t}\n\n\tserviceKind, serviceName, err := h.extractNameAndKind(req.Task.Kind)\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/envoy_bootstrap_hook.go#L235-L271","documentation":"Fired in envoyBootstrapHook.lookupService during Prestart: a connect gateway task (ingress/terminating/mesh gateway) exists, but no service in the task group has the name the gateway task references, so there is nothing to bootstrap against.","triggerScenarios":"Thrown at client/allocrunner/taskrunner/envoy_bootstrap_hook.go:253 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the corresponding gateway service block (e.g. mesh_gateway) to the task group","Correct the gateway task's kind value to reference an existing service name"],"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"}