docker/cli ยท error

cannot configure multiple gateways (%s, %s) for the same sub

Error message

cannot configure multiple gateways (%s, %s) for the same subnet (%s)

What it means

Error "cannot configure multiple gateways (%s, %s) for the same subnet (%s)" thrown in docker/cli.

Source

Thrown at cli/command/network/create.go:205

		}
		if !match {
			return nil, fmt.Errorf("no matching subnet for range %s", r.String())
		}
	}

	// Validate and add valid gateways
	for _, g := range options.gateways {
		match := false
		for _, s := range options.subnets {
			ok, err := subnetMatches(s, g.String())
			if err != nil {
				return nil, err
			}
			if !ok {
				continue
			}
			if iData[s].Gateway.IsValid() {
				return nil, fmt.Errorf("cannot configure multiple gateways (%s, %s) for the same subnet (%s)", g, iData[s].Gateway, s)
			}
			d := iData[s]
			d.Gateway = toNetipAddr(g)
			match = true
		}
		if !match {
			return nil, fmt.Errorf("no matching subnet for gateway %s", g)
		}
	}

	// Validate and add aux-addresses
	for name, aa := range options.auxAddresses.GetAll() {
		if aa == "" {
			continue
		}
		auxAddr, err := netip.ParseAddr(aa)
		if err != nil {
			return nil, err

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/network/create.go:205 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/2914548f73c04608.json. Report an issue: GitHub.