hashicorp/nomad · error

connect gateway task exists but no service associated

Error message

connect gateway task exists but no service associated

What it means

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.

Solutions

  1. Add the corresponding gateway service block (e.g. mesh_gateway) to the task group
  2. Correct the gateway task's kind value to reference an existing service name
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/allocrunner/taskrunner/envoy_bootstrap_hook.go:253 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/04dc13fd182621a0. Report an issue: GitHub.

Appendix: source

Thrown at client/allocrunner/taskrunner/envoy_bootstrap_hook.go:253

}

func (h *envoyBootstrapHook) lookupService(svcKind, svcName string, taskEnv *taskenv.TaskEnv) (*structs.Service, error) {
	tg := h.alloc.Job.LookupTaskGroup(h.alloc.TaskGroup)
	interpolatedServices := taskenv.InterpolateServices(taskEnv, tg.Services)

	var service *structs.Service
	for _, s := range interpolatedServices {
		if s.Name == svcName {
			service = s
			break
		}
	}

	if service == nil {
		if svcKind == structs.ConnectProxyPrefix {
			return nil, errors.New("connect proxy sidecar task exists but no services configured with a sidecar")
		} else {
			return nil, errors.New("connect gateway task exists but no service associated")
		}
	}

	return service, nil
}

// Prestart creates an envoy bootstrap config file.
//
// Must be aware of both launching envoy as a sidecar proxy, as well as a connect gateway.
func (h *envoyBootstrapHook) Prestart(ctx context.Context, req *ifs.TaskPrestartRequest, resp *ifs.TaskPrestartResponse) error {
	if !req.Task.Kind.IsConnectProxy() && !req.Task.Kind.IsAnyConnectGateway() {
		return nil
	}

	serviceKind, serviceName, err := h.extractNameAndKind(req.Task.Kind)
	if err != nil {
		return err
	}

View on GitHub (pinned to 482b49bf1a)