{"record":{"id":"e546bb173d949ffc","repo":"hashicorp/nomad","slug":"no-network-interface-given-and-failed-to-determine","errorCode":null,"errorMessage":"no network_interface given and failed to determine interface attached to default route","messagePattern":"no network_interface given and failed to determine interface attached to default route","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/fingerprint/network.go","lineNumber":345,"sourceCode":"\treturn nwResources, nil\n}\n\n// Returns the interface with the name passed by user. If the name is blank, we\n// use the interface attached to the default route.\nfunc (f *NetworkFingerprint) findInterface(deviceName string) (*net.Interface, error) {\n\t// If we aren't given a device, look it up by using the interface with the default route\n\tif deviceName == \"\" {\n\t\tri, err := sockaddr.NewRouteInfo()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdefaultIfName, err := ri.GetDefaultInterfaceName()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif defaultIfName == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"no network_interface given and failed to determine interface attached to default route\")\n\t\t}\n\t\tdeviceName = defaultIfName\n\t}\n\n\treturn f.interfaceDetector.InterfaceByName(deviceName)\n}\n\n// Define a type for the comparison function\ntype LessFunc[T any] func(a, b T) bool\n\n// Generic sort function\nfunc sortResources[T any](res []T, less LessFunc[T]) {\n\tsort.Slice(res, func(i, j int) bool {\n\t\treturn less(res[i], res[j])\n\t})\n}\n\n// Less functions for each resource type and address family","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/fingerprint/network.go#L327-L363","documentation":"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.","triggerScenarios":"network_interface is empty in the client config AND ri.GetDefaultInterfaceName() returns \"\" without an error — the system cannot report a default-route interface.","commonSituations":"Hosts with no default route (isolated networks, netns without routes); minimal containers lacking route data; environments where the routing table is unavailable or empty.","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."],"exampleFix":"// before\n# network_interface not set, no default route on host\n// after (client config hcl)\nclient {\n  network_interface = \"eth1\"\n}","handlingStrategy":"validation","validationCode":"ifName := cfg.NetworkInterface\nif ifName == \"\" {\n\tout, err := exec.Command(\"ip\", \"route\", \"show\", \"default\").Output()\n\tif err != nil || len(strings.TrimSpace(string(out))) == 0 {\n\t\treturn fmt.Errorf(\"no default route; set network_interface explicitly\")\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := fp.Fingerprint(req); err != nil {\n\tif strings.Contains(err.Error(), \"failed to determine interface attached to default route\") {\n\t\tlog.Print(\"host has no default route; configure network_interface explicitly\")\n\t\treturn nil\n\t}\n\treturn err\n}","preventionTips":["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."],"tags":["network","routing","fingerprinting"],"backgroundTag":"no-default-route-interface","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"}