{"record":{"id":"5a6634e785d811cb","repo":"hashicorp/nomad","slug":"cannot-use-address-mode-alloc-no-allocation-net","errorCode":null,"errorMessage":"cannot use address_mode=\"alloc\": no allocation network status reported","messagePattern":"cannot use address_mode=\"alloc\": no allocation network status reported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/serviceregistration/address.go","lineNumber":145,"sourceCode":"\t\t\t// never intended it to be a numeric and it creates a\n\t\t\t// confusing error message\n\t\t\treturn \"\", 0, fmt.Errorf(\"invalid port label %q: port labels in driver address_mode must be numeric or in the driver's port map\", portLabel)\n\t\t}\n\t\tif port <= 0 {\n\t\t\treturn \"\", 0, fmt.Errorf(\"invalid port: %q: port must be >0\", portLabel)\n\t\t}\n\n\t\treturn driverNet.IP, port, nil\n\n\tcase structs.AddressModeAlloc, structs.AddressModeAllocIPv6:\n\t\t// Cannot use address mode alloc 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.AddressModeAlloc)\n\t\t}\n\n\t\t// Going to need a network for this.\n\t\tif netStatus == nil {\n\t\t\treturn \"\", 0, fmt.Errorf(`cannot use address_mode=\"alloc\": no allocation network status reported`)\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 getAddressPort(addressMode, netStatus, 0)\n\t\t}\n\n\t\t// If port is a label and is found then return it\n\t\tif port, ok := ports.Get(portLabel); ok {\n\t\t\t// Use port.To value unless not set\n\t\t\tif port.To > 0 {\n\t\t\t\treturn getAddressPort(addressMode, netStatus, port.To)\n\t\t\t}\n\n\t\t\treturn getAddressPort(addressMode, netStatus, port.Value)\n\t\t}\n\n\t\t// Check if port is a literal number","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/serviceregistration/address.go#L127-L163","documentation":"Nomad's client service registration helper GetAddress resolves the IP/port a service should advertise. When the service is configured with address_mode=\"alloc\", the address must come from the allocation's reported network status. This error is thrown when that network status is nil, so no allocation-level IP is available to advertise.","triggerScenarios":"A service/check stanza uses address_mode=\"alloc\" (explicitly or via default in host/network modes) but workload.NetworkStatus is nil — i.e., the allocation has no network status reported by the driver/plugins when GetAddress is invoked during serviceRegs or checkRegs.","commonSituations":"Running tasks with a driver that does not report network status (e.g., some non-network-isolating drivers) while services default to alloc address mode; Nomad agents older than 0.12-style network status plumbing; task group without a configured network block where the allocation never gets a network status populated.","solutions":["Set an explicit address_mode on the service (e.g. address_mode=\"host\" or \"driver\") so a network status is not required","Define a network block with a dynamic/static port in the task group so the allocation gets network status","Verify the task driver supports and reports allocation network status (check driver docs/versions)","Upgrade Nomad client/plugins if the driver should report network status but does not"],"exampleFix":"// before\nservice {\n  name = \"api\"\n  port = \"http\"\n  address_mode = \"alloc\"\n}\n// after\nservice {\n  name = \"api\"\n  port = \"http\"\n  address_mode = \"host\"\n}","handlingStrategy":"validation","validationCode":"if service.AddressMode == \"alloc\" && workload.NetworkStatus == nil {\n    return fmt.Errorf(\"service %q: address_mode=alloc requires allocation network status; use address_mode=host or define a network block\", service.Name)\n}","typeGuard":"func hasAllocNetworkStatus(w Workload) bool {\n    return w.NetworkStatus != nil && w.NetworkStatus.Address != \"\"\n}","tryCatchPattern":null,"preventionTips":["Always define a network block with ports when using alloc address mode","Prefer explicit address_mode (host/driver) over relying on defaults","Verify the task driver reports network status before enabling alloc mode","Run nomad job validate to catch address-mode/network mismatches before submission"],"tags":["nomad","service-registration","networking","configuration"],"backgroundTag":"missing-network-status","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"}