grpc/grpc-go · error

endpoints list contains no addresses

Error message

endpoints list contains no addresses

What it means

Returned by resolver.ValidateEndpoints (resolver/resolver.go:358) when the endpoints slice is non-empty but every endpoint has an empty Addresses slice. Having endpoints with no addresses is equivalent to having no usable backends, so the validator rejects it. The loop at lines 353-357 returns nil on the first non-empty Addresses it finds.

Source

Thrown at resolver/resolver.go:358

	// necessary.
	OverrideAuthority(Target) string
}

// ValidateEndpoints validates endpoints from a petiole policy's perspective.
// Petiole policies should call this before calling into their children. See
// [gRPC A61](https://github.com/grpc/proposal/blob/master/A61-IPv4-IPv6-dualstack-backends.md)
// for details.
func ValidateEndpoints(endpoints []Endpoint) error {
	if len(endpoints) == 0 {
		return errors.New("endpoints list is empty")
	}

	for _, endpoint := range endpoints {
		for range endpoint.Addresses {
			return nil
		}
	}
	return errors.New("endpoints list contains no addresses")
}

View on GitHub (pinned to 03255a9237)

Solutions

  1. Ensure each Endpoint you publish has at least one resolver.Address in its Addresses field.
  2. Filter out empty-address endpoints before calling UpdateState/ValidateEndpoints.
  3. Debug the resolver to confirm where the addresses are being dropped.
  4. Fall back to a previous resolver state instead of pushing an all-empty update.

Example fix

// before
eps := []resolver.Endpoint{{Addresses: nil}}
resolver.ValidateEndpoints(eps) // error

// after
for i := range eps {
    if len(eps[i].Addresses) == 0 {
        eps[i].Addresses = []resolver.Address{{Addr: addr}}
    }
}
resolver.ValidateEndpoints(eps)
Defensive patterns

Strategy: validation

Validate before calling

func anyAddresses(eps []resolver.Endpoint) bool {
    for _, e := range eps {
        if len(e.Addresses) > 0 { return true }
    }
    return false
}
if !anyAddresses(eps) { return errors.New("no addresses") }

Prevention

When it happens

Trigger: A resolver produces Endpoint structs with metadata but no populated Addresses; an xDS update carries endpoint objects whose address list was stripped; a wrapper that copies endpoints but drops the inner addresses.

Common situations: Locality-weighted LB configs where all localities have zero weight/addresses; a bug in a custom resolver that fills Endpoint fields except Addresses; partial deserialization of a discovery response.

Related errors


AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07). Data as JSON: /api/errors/e88afdba4166bebe. Report an issue: GitHub.