hashicorp/nomad · error
no network_interface given and failed to determine interface
Error message
no network_interface given and failed to determine interface attached to default route
What it means
findInterface was called without a configured network_interface, so it tried to discover the interface attached to the default route. The route lookup returned an empty interface name without an error, so no device can be selected and the network fingerprinter errors.
Source
Thrown at client/fingerprint/network.go:345
return nwResources, nil
}
// Returns the interface with the name passed by user. If the name is blank, we
// use the interface attached to the default route.
func (f *NetworkFingerprint) findInterface(deviceName string) (*net.Interface, error) {
// If we aren't given a device, look it up by using the interface with the default route
if deviceName == "" {
ri, err := sockaddr.NewRouteInfo()
if err != nil {
return nil, err
}
defaultIfName, err := ri.GetDefaultInterfaceName()
if err != nil {
return nil, err
}
if defaultIfName == "" {
return nil, fmt.Errorf("no network_interface given and failed to determine interface attached to default route")
}
deviceName = defaultIfName
}
return f.interfaceDetector.InterfaceByName(deviceName)
}
// Define a type for the comparison function
type LessFunc[T any] func(a, b T) bool
// Generic sort function
func sortResources[T any](res []T, less LessFunc[T]) {
sort.Slice(res, func(i, j int) bool {
return less(res[i], res[j])
})
}
// Less functions for each resource type and address familyView on GitHub (pinned to 482b49bf1a)
Solutions
- Set an explicit network_interface in the client config instead of relying on default-route detection.
- Add a default route to the host/network namespace so GetDefaultInterfaceName can resolve one.
- Verify routing with 'ip route show default' and fix network configuration.
- Disable the network fingerprinter if no network fingerprint is required.
Example fix
// before
# network_interface not set, no default route on host
// after (client config hcl)
client {
network_interface = "eth1"
} Defensive patterns
Strategy: validation
Validate before calling
ifName := cfg.NetworkInterface
if ifName == "" {
out, err := exec.Command("ip", "route", "show", "default").Output()
if err != nil || len(strings.TrimSpace(string(out))) == 0 {
return fmt.Errorf("no default route; set network_interface explicitly")
}
} Try / catch
if err := fp.Fingerprint(req); err != nil {
if strings.Contains(err.Error(), "failed to determine interface attached to default route") {
log.Print("host has no default route; configure network_interface explicitly")
return nil
}
return err
} Prevention
- Always set network_interface explicitly on hosts without a default route.
- Check `ip route show default` before deploying clients in netns/containers.
- Avoid relying on auto-detection in minimal network namespaces.
- Disable the network fingerprinter for network-isolated nodes.
When it happens
Trigger: network_interface is empty in the client config AND ri.GetDefaultInterfaceName() returns "" without an error — the system cannot report a default-route interface.
Common situations: Hosts with no default route (isolated networks, netns without routes); minimal containers lacking route data; environments where the routing table is unavailable or empty.
Related errors
- Error while detecting network interface %s during fingerprin
- missing accessor ID
- network namespace already exists but was misconfigured
- network already configured but not found in state
- no CNI network config found
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/e546bb173d949ffc.
Report an issue: GitHub.