hashicorp/nomad · error

could not parse default_outbound_port %q as port number: %w

Error message

could not parse default_outbound_port %q as port number: %w

What it means

In setupTransparentProxyArgs, the transparent proxy's default_outbound_port value (from Consul service-defaults or node metadata) is not a valid numeric port, so strconv parsing fails and network setup aborts.

Source

Thrown at client/allocrunner/networking_cni.go:303

			// Envoy container with a different UID
			proxyUID = c.nodeMeta[envoy.DefaultTransparentProxyUIDParam]
			if tproxy.UID != "" {
				proxyUID = tproxy.UID
			}

			// The value for the outbound Envoy port. The default value matches
			// the default TransparentProxy service default for
			// OutboundListenerPort. If the cluster admin sets this value to
			// something non-default, they'll need to update the metadata on all
			// the nodes to match. see also:
			// https://developer.hashicorp.com/consul/docs/connect/config-entries/service-defaults#transparentproxy
			if tproxy.OutboundPort != 0 {
				proxyOutboundPort = int(tproxy.OutboundPort)
			} else {
				outboundPortAttr := c.nodeMeta[envoy.DefaultTransparentProxyOutboundPortParam]
				parsedOutboundPort, err := strconv.ParseUint(outboundPortAttr, 10, 16)
				if err != nil {
					return nil, fmt.Errorf(
						"could not parse default_outbound_port %q as port number: %w",
						outboundPortAttr, err)
				}
				proxyOutboundPort = int(parsedOutboundPort)
			}

			// The inbound port is the service port exposed on the Envoy proxy
			envoyPortLabel := "connect-proxy-" + svc.Name
			if envoyPort, ok := portMaps.get(envoyPortLabel); ok {
				proxyInboundPort = int(envoyPort.HostPort)
			}

			// Extra user-defined ports that get excluded from outbound redirect
			if len(tproxy.ExcludeOutboundPorts) == 0 {
				outboundPorts = nil
			} else {
				outboundPorts = helper.ConvertSlice(tproxy.ExcludeOutboundPorts,
					func(p uint16) string { return fmt.Sprint(p) })

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Fix OutboundListenerPort in Consul transparent proxy service-defaults to a valid port number
  2. Correct the node metadata value for the outbound port parameter
  3. Resync node metadata and retry the allocation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/allocrunner/networking_cni.go:303 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/8878460f03b8f708. Report an issue: GitHub.