caddyserver/caddy · error

resolver address must have exactly one address; cannot call

Error message

resolver address must have exactly one address; cannot call %v

What it means

Error "resolver address must have exactly one address; cannot call %v" thrown in caddyserver/caddy.

Source

Thrown at modules/caddyhttp/reverseproxy/upstreams.go:547

	// It accepts [network addresses](/docs/conventions#network-addresses)
	// with port range of only 1. If the host is an IP address, it will be dialed directly to resolve the upstream server.
	// If the host is not an IP address, the addresses are resolved using the [name resolution convention](https://golang.org/pkg/net/#hdr-Name_Resolution) of the Go standard library.
	// If the array contains more than 1 resolver address, one is chosen at random.
	Addresses []string `json:"addresses,omitempty"`
	netAddrs  []caddy.NetworkAddress
}

// ParseAddresses parses all the configured network addresses
// and ensures they're ready to be used.
func (u *UpstreamResolver) ParseAddresses() error {
	u.netAddrs = make([]caddy.NetworkAddress, 0, len(u.Addresses))
	for _, v := range u.Addresses {
		addr, err := caddy.ParseNetworkAddressWithDefaults(v, "udp", 53)
		if err != nil {
			return err
		}
		if addr.PortRangeSize() != 1 {
			return fmt.Errorf("resolver address must have exactly one address; cannot call %v", addr)
		}
		u.netAddrs = append(u.netAddrs, addr)
	}
	return nil
}

func allNew(upstreams []Upstream) []*Upstream {
	results := make([]*Upstream, len(upstreams))
	for i := range upstreams {
		results[i] = &Upstream{Dial: upstreams[i].Dial}
	}
	return results
}

var (
	srvs   = make(map[string]srvLookup)
	srvsMu sync.RWMutex

View on GitHub (pinned to 50e54ee279)

Solutions

  1. Use a single resolver address (host:port) without port ranges or multiple addresses.

When it happens

Trigger: Thrown at modules/caddyhttp/reverseproxy/upstreams.go:547 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15). Data as JSON: /api/errors/c408853cf88a01d5. Report an issue: GitHub.