hashicorp/nomad · error
task for Consul Connect Native service %s->%s is ambiguous a
Error message
task for Consul Connect Native service %s->%s is ambiguous and must be set
What it means
Fires in getNamedTaskForNativeService when a Connect-native service names no task and the group contains more than one task: Nomad cannot infer which task exposes the service, so the task name must be set explicitly.
Source
Thrown at nomad/job_endpoint_hook_connect.go:228
}
func isTerminatingGatewayForService(t *structs.Task, svc string) bool {
return t.Kind == structs.NewTaskKind(structs.ConnectTerminatingPrefix, svc)
}
func isMeshGatewayForService(t *structs.Task, svc string) bool {
return t.Kind == structs.NewTaskKind(structs.ConnectMeshPrefix, svc)
}
// 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
}
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Set the task field on the group's connect-native service block
- Or reduce the group to a single task so the name can be inferred
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at nomad/job_endpoint_hook_connect.go:228 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/818ad24f1d692614.
Report an issue: GitHub.