hashicorp/nomad · error

task %s named by Consul Connect Native service %s->%s does n

Error message

task %s named by Consul Connect Native service %s->%s does not exist

What it means

Fires in getNamedTaskForNativeService when the service's task name does not match any task in the task group — the Connect-native service points at a task that does not exist.

Source

Thrown at nomad/job_endpoint_hook_connect.go:236

}

// getNamedTaskForNativeService retrieves the Task with the name specified in the
// group service definition. If the task name is empty and there is only one task
// in the group, infer the name from the only option.
func getNamedTaskForNativeService(tg *structs.TaskGroup, serviceName, taskName string) (*structs.Task, error) {
	if taskName == "" {
		if len(tg.Tasks) == 1 {
			return tg.Tasks[0], nil
		}
		return nil, fmt.Errorf("task for Consul Connect Native service %s->%s is ambiguous and must be set", tg.Name, serviceName)
	}

	for _, t := range tg.Tasks {
		if t.Name == taskName {
			return t, nil
		}
	}
	return nil, fmt.Errorf("task %s named by Consul Connect Native service %s->%s does not exist", taskName, tg.Name, serviceName)
}

func injectPort(group *structs.TaskGroup, label string) {
	// check that port hasn't already been defined before adding it to tg
	for _, p := range group.Networks[0].DynamicPorts {
		if p.Label == label {
			return
		}
	}

	// inject a port of label that maps inside the bridge namespace
	group.Networks[0].DynamicPorts = append(group.Networks[0].DynamicPorts, structs.Port{
		Label: label,
		// -1 is a sentinel value to instruct the
		// scheduler to map the host's dynamic port to
		// the same port in the netns.
		To: -1,
	})

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Correct the task name in the connect-native service to match an existing task in the group
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/job_endpoint_hook_connect.go:236 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/1d842ad66d701187. Report an issue: GitHub.