{"record":{"id":"68aa5d66bef9f6cc","repo":"hashicorp/nomad","slug":"tasks-s-and-s-want-to-initiate-networking-but-on","errorCode":null,"errorMessage":"tasks %s and %s want to initiate networking but only one driver can do so","messagePattern":"tasks (.+?) and (.+?) want to initiate networking but only one driver can do so","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/network_manager_linux.go","lineNumber":87,"sourceCode":"\t\t}\n\n\t\tcaps, err := driver.Capabilities()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to retrieve capabilities for driver %s: %v\",\n\t\t\t\ttask.Driver, err)\n\t\t}\n\n\t\t// check that the driver supports the requested network isolation mode\n\t\tnetIsolationMode := netModeToIsolationMode(taskNetMode)\n\t\tif !caps.HasNetIsolationMode(netIsolationMode) {\n\t\t\treturn nil, fmt.Errorf(\"task %s does not support %q networking mode\", task.Name, taskNetMode)\n\t\t}\n\n\t\t// check if the driver needs to create the network and if a different\n\t\t// driver has already claimed it needs to initiate the network\n\t\tif caps.MustInitiateNetwork {\n\t\t\tif networkInitiator != \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"tasks %s and %s want to initiate networking but only one driver can do so\", networkInitiator, task.Name)\n\t\t\t}\n\t\t\tnetManager, ok := driver.(drivers.DriverNetworkManager)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"driver %s does not implement network management RPCs\", task.Driver)\n\t\t\t}\n\n\t\t\tnm = netManager\n\t\t\tnetworkInitiator = task.Name\n\t\t} else if len(tg.Networks) > 0 && tg.Networks[0].Hostname != \"\" {\n\t\t\t// TODO jrasell: remove once the default linux network manager\n\t\t\t//  supports setting the hostname in bridged mode. This currently\n\t\t\t//  indicates only Docker supports this, which is true unless a\n\t\t\t//  custom driver can which means this check still holds as true as\n\t\t\t//  we can tell.\n\t\t\t//  Please see: https://github.com/hashicorp/nomad/issues/11180\n\t\t\treturn nil, fmt.Errorf(\"hostname is not currently supported on driver %s\", task.Driver)\n\t\t}\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/network_manager_linux.go#L69-L105","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Restructure the job so only one task's driver initiates networking (move the second task to its own group).","Use a non-initiating driver for one of the tasks (e.g. connect via network mode host).","If using a custom driver, unset MustInitiateNetwork in its Capabilities unless it truly must create the netns."],"exampleFix":"// before\ntask \"web\" { driver = \"docker\" }\ntask \"other-netns\" { driver = \"custom-cni-driver\" }\n// after\ntask \"web\" { driver = \"docker\" }\ntask \"other-netns\" { driver = \"exec\" }","handlingStrategy":"validation","validationCode":"// ensure only one task per group uses a MustInitiateNetwork driver\ninitiators := tasksWithMustInitiateNetwork(group)\nif len(initiators) > 1 { reject(\"group has multiple network initiators\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep at most one networking-initiating driver per task group.","Document MustInitiateNetwork behavior for custom driver plugins.","Split multi-driver groups into separate allocation groups."],"tags":["nomad","network-initiator","task-group","conflict"],"backgroundTag":"multiple-network-initiators","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"}