hashicorp/nomad · error

tasks %s and %s want to initiate networking but only one dri

Error message

tasks %s and %s want to initiate networking but only one driver can do so

What it means

If multiple tasks in the group have caps.MustInitiateNetwork, more than one driver claims the right to create the shared network namespace. newNetworkManager allows only one network initiator, so it errors naming the previously-claimed task and the current task.

Source

Thrown at client/allocrunner/network_manager_linux.go:87

		}

		caps, err := driver.Capabilities()
		if err != nil {
			return nil, fmt.Errorf("failed to retrieve capabilities for driver %s: %v",
				task.Driver, err)
		}

		// check that the driver supports the requested network isolation mode
		netIsolationMode := netModeToIsolationMode(taskNetMode)
		if !caps.HasNetIsolationMode(netIsolationMode) {
			return nil, fmt.Errorf("task %s does not support %q networking mode", task.Name, taskNetMode)
		}

		// check if the driver needs to create the network and if a different
		// driver has already claimed it needs to initiate the network
		if caps.MustInitiateNetwork {
			if networkInitiator != "" {
				return nil, fmt.Errorf("tasks %s and %s want to initiate networking but only one driver can do so", networkInitiator, task.Name)
			}
			netManager, ok := driver.(drivers.DriverNetworkManager)
			if !ok {
				return nil, fmt.Errorf("driver %s does not implement network management RPCs", task.Driver)
			}

			nm = netManager
			networkInitiator = task.Name
		} else if len(tg.Networks) > 0 && tg.Networks[0].Hostname != "" {
			// TODO jrasell: remove once the default linux network manager
			//  supports setting the hostname in bridged mode. This currently
			//  indicates only Docker supports this, which is true unless a
			//  custom driver can which means this check still holds as true as
			//  we can tell.
			//  Please see: https://github.com/hashicorp/nomad/issues/11180
			return nil, fmt.Errorf("hostname is not currently supported on driver %s", task.Driver)
		}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Restructure the job so only one task's driver initiates networking (move the second task to its own group).
  2. Use a non-initiating driver for one of the tasks (e.g. connect via network mode host).
  3. If using a custom driver, unset MustInitiateNetwork in its Capabilities unless it truly must create the netns.

Example fix

// before
task "web" { driver = "docker" }
task "other-netns" { driver = "custom-cni-driver" }
// after
task "web" { driver = "docker" }
task "other-netns" { driver = "exec" }
Defensive patterns

Strategy: validation

Validate before calling

// ensure only one task per group uses a MustInitiateNetwork driver
initiators := tasksWithMustInitiateNetwork(group)
if len(initiators) > 1 { reject("group has multiple network initiators") }

Prevention

When it happens

Trigger: Two or more tasks in one task group use drivers whose Capabilities set MustInitiateNetwork=true (e.g. two docker tasks with bridge group networking plus another initiator-capable driver), while building the network manager.

Common situations: Mixing driver plugins that both request network initiation in a single group; accidentally setting MustInitiateNetwork in a custom driver; docker plus a custom CNI-managed driver in the same group network.

Related errors


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