{"record":{"id":"f3faee2fe6196103","repo":"hashicorp/nomad","slug":"no-networks-available","errorCode":null,"errorMessage":"no networks available","messagePattern":"no networks available","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/network.go","lineNumber":577,"sourceCode":"\n\t\t\treturn nil, fmt.Errorf(\"no addresses available for %s network\", port.HostNetwork)\n\t\t}\n\t\toffer = append(offer, *allocPort)\n\t\tportsInOffer = append(portsInOffer, allocPort.Value)\n\t}\n\n\treturn offer, nil\n}\n\n// AssignTaskNetwork is used to offer network resources given a\n// task.resources.network ask.  If the ask cannot be satisfied, returns nil\n//\n// AssignTaskNetwork and task.resources.network are deprecated in favor of\n// AssignPorts and group.network. AssignTaskNetwork does not support multiple\n// interfaces and only uses the node's default interface. AssignPorts is the\n// method that is used for group.network asks.\nfunc (idx *NetworkIndex) AssignTaskNetwork(ask *NetworkResource) (out *NetworkResource, err error) {\n\terr = fmt.Errorf(\"no networks available\")\n\tidx.yieldIP(func(n *NetworkResource, offerIP net.IP) (stop bool) {\n\t\t// Convert the IP to a string\n\t\tofferIPStr := offerIP.String()\n\n\t\t// Check if we would exceed the bandwidth cap\n\t\tavailBandwidth := idx.AvailBandwidth[n.Device]\n\t\tusedBandwidth := idx.UsedBandwidth[n.Device]\n\t\tif usedBandwidth+ask.MBits > availBandwidth {\n\t\t\terr = fmt.Errorf(\"bandwidth exceeded\")\n\t\t\treturn\n\t\t}\n\n\t\tused := idx.UsedPorts[offerIPStr]\n\n\t\t// Check if any of the reserved ports are in use\n\t\tfor _, port := range ask.ReservedPorts {\n\t\t\t// Guard against invalid port\n\t\t\tif port.Value < 0 || port.Value >= MaxValidPort {","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/network.go#L559-L595","documentation":"AssignTaskNetwork (the deprecated task-level network API) initializes its error to \"no networks available\" and only clears it if yieldIP finds a usable node network satisfying the ask. If the node has no advertised networks (or none survive the yield loop), this error is returned. It signals the node index has no candidate IP for the task network resource.","triggerScenarios":"Calling NetworkIndex.AssignTaskNetwork on an index whose Node has empty/nil Networks, or where every device was filtered out before an offer could be built.","commonSituations":"Client node registered without a network stanza; older task `resources.network` blocks placed on nodes with no advertised interfaces; tests constructing a NetworkIndex without attaching a node.","solutions":["Add a proper network block to the Nomad client config so the node advertises interfaces.","Migrate from task resources.network to group network blocks and AssignPorts (AssignTaskNetwork is deprecated).","Verify the node re-registered with its networks after config change (nomad node status).","In tests, populate idx.Node.Networks before calling AssignTaskNetwork."],"exampleFix":"// before (client.hcl)\nclient { enabled = true }\n// after\nclient { enabled = true }\nnetwork_interface = \"eth0\"\n# or explicit network stanza so idx.Node.Networks is populated","handlingStrategy":"try-catch","validationCode":"idx, _ := state.NodeByID(nil, ws, nodeID)\nif idx == nil || len(idx.Node.Networks) == 0 {\n  return fmt.Errorf(\"node %s advertises no networks; fix client network config\", nodeID)\n}","typeGuard":"func nodeHasAdvertisedNetworks(n *structs.Node) bool { return n != nil && len(n.Networks) > 0 }","tryCatchPattern":"offer, err := idx.AssignTaskNetwork(ask)\nif err != nil {\n  if err.Error() == \"no networks available\" {\n    // mark node ineligible or fall back to another node\n  }\n  return err\n}","preventionTips":["Always configure network_interface or a network stanza on Nomad clients","Migrate off deprecated task resources.network to group network blocks","Check `nomad node status` shows drivers/networks before scheduling"],"tags":["nomad","network","deprecated-api","scheduling"],"backgroundTag":"no-network-available","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"}