grpc/grpc-java · error · ResourceInvalidException

Invalid Resource in address proto

Error message

Invalid Resource in address proto

What it means

This parser unpacks an envoy Address proto from an google.protobuf.Any (used for extraAddresses / endpoint address parsing). If the Any cannot be unpacked (wrong type URL or corrupted bytes), an InvalidProtocolBufferException is converted to ResourceInvalidException('Invalid Resource in address proto').

Source

Thrown at xds/src/main/java/io/grpc/xds/XdsEndpointResource.java:319

              .add("dropPolicies", dropPolicies)
              .toString();
    }
  }

  public static class AddressMetadataParser implements MetadataValueParser {

    @Override
    public String getTypeUrl() {
      return "type.googleapis.com/envoy.config.core.v3.Address";
    }

    @Override
    public java.net.SocketAddress parse(Any any) throws ResourceInvalidException {
      SocketAddress socketAddress;
      try {
        socketAddress = any.unpack(Address.class).getSocketAddress();
      } catch (InvalidProtocolBufferException ex) {
        throw new ResourceInvalidException("Invalid Resource in address proto", ex);
      }
      validateAddress(socketAddress);

      String ip = socketAddress.getAddress();
      int port = socketAddress.getPortValue();

      try {
        return new InetSocketAddress(InetAddresses.forString(ip), port);
      } catch (IllegalArgumentException e) {
        throw createException("Invalid IP address or port: " + ip + ":" + port);
      }
    }

    private void validateAddress(SocketAddress socketAddress) throws ResourceInvalidException {
      if (socketAddress.getAddress().isEmpty()) {
        throw createException("Address field is empty or invalid.");
      }
      long port = Integer.toUnsignedLong(socketAddress.getPortValue());

View on GitHub (pinned to 64daddc1f3)

Solutions

  1. Ensure the control plane sets type_url to the envoy.config.core.v3.Address type URL and packs a valid Address message
  2. Check control plane/client proto version skew (v3 Address expected, not v2)
  3. Regenerate or re-serialize the offending resource and re-push it
  4. Log the Any's type_url on the management server to confirm what was actually sent

Example fix

// before
any { type_url: "type.googleapis.com/envoy.config.core.v3.SocketAddress" value: "..." }
// after
any { type_url: "type.googleapis.com/envoy.config.core.v3.Address" value: "..." }
Defensive patterns

Strategy: validation

Validate before calling

// Control-plane side: confirm the Any unpacks as Address before sending
try {
  any.unpack(io.envoyproxy.envoy.config.core.v3.Address.class);
} catch (InvalidProtocolBufferException e) {
  throw new IllegalStateException("Invalid Resource in address proto: " + any.getTypeUrl(), e);
}

Type guard

boolean isValidAddressAny(com.google.protobuf.Any any) {
  try {
    any.unpack(io.envoyproxy.envoy.config.core.v3.Address.class);
    return true;
  } catch (InvalidProtocolBufferException e) {
    return false;
  }
}

Try / catch

// Client side: surface the NACK with the address-proto cause
@Override public void onError(Status error) {
  if (error.getDescription().contains("Invalid Resource in address proto")) {
    logger.log(WARNING, "Unpackable Address Any in resource: " + error.getDescription());
  }
}

Prevention

When it happens

Trigger: An Any field in an EDS resource (e.g. endpoint address or extra_addresses) has a type_url that does not match type.googleapis.com/envoy.config.core.v3.Address or whose payload bytes are not a valid Address proto; unpack(Any -> Address) throws and the resource is rejected.

Common situations: Custom management server packs the wrong message type into the Any; version skew between control plane proto packages (envoy v2 vs v3 Any payloads); corrupted or hand-mangled serialized resources in tests.

Understand the failure class

Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.

Related errors


AI-assisted analysis of grpc/grpc-java@64daddc1f3 (2026-09-08). Data as JSON: /api/errors/0bd30c0ffb1ce860. Report an issue: GitHub.