hashicorp/nomad · error

no addresses available for %s network

Error message

no addresses available for %s network

What it means

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.

Source

Thrown at nomad/structs/network.go:514

				}
			}

			allocPort = &AllocatedPortMapping{
				Label:           port.Label,
				Value:           port.Value,
				To:              port.To,
				HostIP:          addr.Address,
				IgnoreCollision: port.IgnoreCollision,
			}
			break
		}

		if allocPort == nil {
			if addrErr != nil {
				return nil, addrErr
			}

			return nil, fmt.Errorf("no addresses available for %s network", port.HostNetwork)
		}

		offer = append(offer, *allocPort)
		portsInOffer = append(portsInOffer, allocPort.Value)
	}

	for _, port := range ask.DynamicPorts {
		var allocPort *AllocatedPortMapping
		var addrErr error
		for _, addr := range idx.HostNetworks[port.HostNetwork] {
			used := idx.getUsedPortsFor(addr.Address)
			// Try to stochastically pick the dynamic ports as it is faster and
			// lower memory usage.
			var dynPorts []int
			// TODO: its more efficient to find multiple dynamic ports at once
			dynPorts, addrErr = getDynamicPortsStochastic(
				used, portsInOffer, idx.MinDynamicPort, idx.MaxDynamicPort,
				reservedIdx[port.HostNetwork], 1)

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify the host_network name in the job matches a network declared in the client's node network stanza (nomad node status -verbose).
  2. Check the node's advertised addresses for that host network and correct the client config.
  3. Remove or relax the host_network constraint so any interface can serve the allocation.
  4. Re-run node eligibility / update node data if the node's networks are stale.

Example fix

// before (job HCL)
network { port "http" { static = 8080 } host_network = "prodnet" }
// after
network { port "http" { static = 8080 } host_network = "public" } // name matching client network stanza
Defensive patterns

Strategy: validation

Validate before calling

// verify the node advertises the host_network before constraining the job
# nomad node status -verbose <id> | grep -i host_networks
# ensure job host_network name matches an entry exactly

Type guard

func hasHostNetwork(node *api.Node, name string) bool {
  for _, n := range node.Networks {
    if n.HostNetworkName == name { return true }
  }
  return false
}

Try / catch

null

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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