{"record":{"id":"a6f36be25679739a","repo":"hashicorp/nomad","slug":"invalid-port-label-q-port-labels-in-driver-addre","errorCode":null,"errorMessage":"invalid port label %q: port labels in driver address_mode must be numeric or in the driver's port map","messagePattern":"invalid port label %q: port labels in driver address_mode must be numeric or in the driver's port map","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/serviceregistration/address.go","lineNumber":129,"sourceCode":"\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\n\t\tport, err := strconv.Atoi(portLabel)\n\t\tif err != nil {\n\t\t\t// Don't include Atoi error message as user likely\n\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","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/serviceregistration/address.go#L111-L147","documentation":"Returned by GetAddress in driver address_mode when the port label is absent from the driver's port map and is not a numeric literal. Driver-mode addresses must come from the driver network's mapped ports.","triggerScenarios":"Thrown at client/serviceregistration/address.go:129 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a numeric port or a label present in the driver's port map","Define the port in the group network block"],"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"}