{"record":{"id":"1b80a6e241d77f8f","repo":"hashicorp/nomad","slug":"cannot-use-address-mode-driver-no-driver-networ","errorCode":null,"errorMessage":"cannot use address_mode=\"driver\": no driver network exists","messagePattern":"cannot use address_mode=\"driver\": no driver network exists","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/serviceregistration/address.go","lineNumber":105,"sourceCode":"\t\t\tif port <= 0 {\n\t\t\t\treturn \"\", 0, fmt.Errorf(\"invalid port: %q: port must be >0\", portLabel)\n\t\t\t}\n\n\t\t\t// A number was given which will use the Consul agent's address and the given port\n\t\t\t// Returning a blank string as an address will use the Consul agent's address\n\t\t\treturn \"\", port, nil\n\t\t}\n\t\treturn mapping.HostIP, mapping.Value, nil\n\n\tcase structs.AddressModeDriver:\n\t\t// Cannot use address mode driver with custom advertise address.\n\t\tif address != \"\" {\n\t\t\treturn \"\", 0, fmt.Errorf(\"cannot use custom advertise address with %q address mode\", structs.AddressModeDriver)\n\t\t}\n\n\t\t// Require a driver network if driver address mode is used\n\t\tif driverNet == nil {\n\t\t\treturn \"\", 0, fmt.Errorf(`cannot use address_mode=\"driver\": no driver network exists`)\n\t\t}\n\n\t\t// If no port label is specified just return the IP\n\t\tif portLabel == \"\" {\n\t\t\treturn driverNet.IP, 0, nil\n\t\t}\n\n\t\t// If the port is a label, use the driver's port (not the host's)\n\t\tif port, ok := ports.Get(portLabel); ok {\n\t\t\treturn driverNet.IP, port.To, nil\n\t\t}\n\n\t\t// Check if old style driver portmap is used\n\t\tif port, ok := driverNet.PortMap[portLabel]; ok {\n\t\t\treturn driverNet.IP, port, nil\n\t\t}\n\n\t\t// If port isn't a label, try to parse it as a literal port number","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/serviceregistration/address.go#L87-L123","documentation":"GetAddress with AddressModeDriver requires a driver network in the allocation's networks; when no driver network exists (e.g. host networking only), driver address mode cannot resolve an IP and the registration fails.","triggerScenarios":"Thrown at client/serviceregistration/address.go:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a task driver that provides a network when address_mode=\"driver\"","Switch address_mode to \"host\" or \"auto\" for non-driver-network tasks"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}