{"record":{"id":"c4488b5d8fc3ef00","repo":"hashicorp/nomad","slug":"bandwidth-exceeded","errorCode":null,"errorMessage":"bandwidth exceeded","messagePattern":"bandwidth exceeded","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/network.go","lineNumber":586,"sourceCode":"\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 {\n\t\t\t\terr = fmt.Errorf(\"invalid port %d (out of range)\", port.Value)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Check if in use\n\t\t\tif used != nil && used.Check(uint(port.Value)) {\n\t\t\t\terr = fmt.Errorf(\"reserved port collision %s=%d\", port.Label, port.Value)\n\t\t\t\treturn\n\t\t\t}","sourceCodeStart":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/network.go#L568-L604","documentation":"Inside AssignTaskNetwork's yieldIP callback, the ask's MBits plus the device's already-used bandwidth exceeds idx.AvailBandwidth for that device, so the candidate network is rejected with \"bandwidth exceeded\". This is the deprecated task-network path's bandwidth reservation check.","triggerScenarios":"AssignTaskNetwork called with ask.MBits such that usedBandwidth[device] + ask.MBits > availBandwidth[device] for the yielded network device.","commonSituations":"Node link speed misdetected (e.g., 0 or 100 Mbps link), many tasks reserving MBits on one device, job requesting more MBits than the interface's total capacity.","solutions":["Lower the task's resources.network.mbits request to fit available device bandwidth.","Fix the client's link speed detection / set interface speed so AvailBandwidth is correct.","Schedule on a different node or device with free bandwidth.","Migrate to group network mode = \"bridge\", which does not consume device MBits reservations this way."],"exampleFix":"// before (job HCL)\nresources { network { mbits = 500 } }\n// after\nresources { network { mbits = 50 } } // within device AvailBandwidth","handlingStrategy":"validation","validationCode":"// keep ask.MBits within the device's advertised capacity\nif ask.MBits > nodeAvailMBits(device) {\n  return fmt.Errorf(\"ask %d MBits exceeds %d available on %s\", ask.MBits, nodeAvailMBits(device), device)\n}","typeGuard":"func fitsBandwidth(ask, used, avail int) bool { return used+ask <= avail }","tryCatchPattern":"null","preventionTips":["Keep per-task mbits small; most CNI/bridge workloads don't need device reservations","Verify node link speed detection is correct (ip link / ethtool)","Distribute bandwidth-heavy workloads across nodes"],"tags":["nomad","bandwidth","network","deprecated-api"],"backgroundTag":"bandwidth-exceeded","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}