{"record":{"id":"e2fc6fcfc0a74bc0","repo":"hashicorp/nomad","slug":"no-addresses-available-for-s-network","errorCode":null,"errorMessage":"no addresses available for %s network","messagePattern":"no addresses available for (.+?) network","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/network.go","lineNumber":514,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\n\t\t\tallocPort = &AllocatedPortMapping{\n\t\t\t\tLabel:           port.Label,\n\t\t\t\tValue:           port.Value,\n\t\t\t\tTo:              port.To,\n\t\t\t\tHostIP:          addr.Address,\n\t\t\t\tIgnoreCollision: port.IgnoreCollision,\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tif allocPort == nil {\n\t\t\tif addrErr != nil {\n\t\t\t\treturn nil, addrErr\n\t\t\t}\n\n\t\t\treturn nil, fmt.Errorf(\"no addresses available for %s network\", port.HostNetwork)\n\t\t}\n\n\t\toffer = append(offer, *allocPort)\n\t\tportsInOffer = append(portsInOffer, allocPort.Value)\n\t}\n\n\tfor _, port := range ask.DynamicPorts {\n\t\tvar allocPort *AllocatedPortMapping\n\t\tvar addrErr error\n\t\tfor _, addr := range idx.HostNetworks[port.HostNetwork] {\n\t\t\tused := idx.getUsedPortsFor(addr.Address)\n\t\t\t// Try to stochastically pick the dynamic ports as it is faster and\n\t\t\t// lower memory usage.\n\t\t\tvar dynPorts []int\n\t\t\t// TODO: its more efficient to find multiple dynamic ports at once\n\t\t\tdynPorts, addrErr = getDynamicPortsStochastic(\n\t\t\t\tused, portsInOffer, idx.MinDynamicPort, idx.MaxDynamicPort,\n\t\t\t\treservedIdx[port.HostNetwork], 1)","sourceCodeStart":496,"sourceCodeEnd":532,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/network.go#L496-L532","documentation":"During AssignPorts, no allocation succeeded for a requested port on any address of the given host_network: allocPort remained nil and no more specific address error (like a port collision) was recorded. The scheduler had no usable IP for that network, so it cannot build an offer.","triggerScenarios":"Calling AssignPorts where a port ask references a host_network whose addresses were all exhausted, filtered out, or where no interface matches the requested HostNetwork label and no addrErr was set.","commonSituations":"Typo in the job spec's host_network name; node's network stanza does not advertise the requested host network; all candidate IPs on that network were rejected without setting addrErr.","solutions":["Verify the host_network name in the job matches a network declared in the client's node network stanza (nomad node status -verbose).","Check the node's advertised addresses for that host network and correct the client config.","Remove or relax the host_network constraint so any interface can serve the allocation.","Re-run node eligibility / update node data if the node's networks are stale."],"exampleFix":"// before (job HCL)\nnetwork { port \"http\" { static = 8080 } host_network = \"prodnet\" }\n// after\nnetwork { port \"http\" { static = 8080 } host_network = \"public\" } // name matching client network stanza","handlingStrategy":"validation","validationCode":"// verify the node advertises the host_network before constraining the job\n# nomad node status -verbose <id> | grep -i host_networks\n# ensure job host_network name matches an entry exactly","typeGuard":"func hasHostNetwork(node *api.Node, name string) bool {\n  for _, n := range node.Networks {\n    if n.HostNetworkName == name { return true }\n  }\n  return false\n}","tryCatchPattern":"null","preventionTips":["Copy host_network names from `nomad node status -verbose`, don't type them by hand","Run a constraint check (node unique attribute / host_network presence) in CI against the live cluster","Update client network stanza and restart nomad agent after interface changes"],"tags":["nomad","network","host-network","scheduling"],"backgroundTag":"no-network-interface-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"}