grpc/grpc-java · error · ResourceInvalidException
Unknown source-type
Error message
Unknown source-type: ${proto.getSourceType()} What it means
The FilterChainMatch's source_type field contains a value the gRPC xDS parser does not recognize. Only ANY, EXTERNAL, and SAME_IP_OR_LOOPBACK are mapped; anything else (typically an unrecognized future enum value) causes a ResourceInvalidException.
Solutions
- Set source_type to ANY, EXTERNAL, or SAME_IP_OR_LOOPBACK (or omit it to use the default ANY).
- Upgrade the gRPC library so it recognizes the enum value your control plane emits.
- Downgrade or reconfigure the control plane not to send newer source_type values to older clients.
Example fix
// before
filter_chain_match: { source_type: SOME_NEW_TYPE }
// after
filter_chain_match: { source_type: ANY } Defensive patterns
Strategy: validation
Validate before calling
if (match.getSourceType() != ANY && match.getSourceType() != EXTERNAL
&& match.getSourceType() != SAME_IP_OR_LOOPBACK) {
throw new IllegalArgumentException("source_type not supported by grpc xds");
} Try / catch
try { applyResource(listener) } catch (ResourceInvalidException e) { if (e.getMessage().startsWith("Unknown source-type")) fallbackToSourceTypeAny(); } Prevention
- Only emit ANY, EXTERNAL, or SAME_IP_OR_LOOPBACK in source_type
- Keep control plane enum knowledge in sync with the gRPC xDS client version
- Avoid sending numeric enum values unknown to the client
When it happens
Trigger: FilterChainMatch proto with source_type set to an enum value other than ANY/EXTERNAL/SAME_IP_OR_LOOPBACK (falls through the switch's default in parseFilterChainMatch), usually because the control plane emitted a newer Envoy enum value than this gRPC version understands.
Common situations: Envoy control plane newer than the gRPC xDS client library, manually crafted protos with numeric enum values, or protos deserialized from JSON with an invalid string for source_type.
Related errors
- A terminal HttpFilter must be the last filter
- AndMatcher must have at least 2 predicates
- client_listener_resource_name_template
- Cluster " + cluster.getName() + ": unspecified cluster…
- common-tls-context is required in upstream-tls-context
AI-assisted analysis of grpc/grpc-java@64daddc1f3 (2026-09-08).
Data as JSON: /api/errors/12c8d151ecf213e9.
Report an issue: GitHub.
Appendix: source
Thrown at xds/src/main/java/io/grpc/xds/XdsListenerResource.java:481
InetAddresses.forString(range.getAddressPrefix()), range.getPrefixLen().getValue()));
}
} catch (IllegalArgumentException ex) {
throw new ResourceInvalidException("Failed to create CidrRange", ex);
}
ConnectionSourceType sourceType;
switch (proto.getSourceType()) {
case ANY:
sourceType = ConnectionSourceType.ANY;
break;
case EXTERNAL:
sourceType = ConnectionSourceType.EXTERNAL;
break;
case SAME_IP_OR_LOOPBACK:
sourceType = ConnectionSourceType.SAME_IP_OR_LOOPBACK;
break;
default:
throw new ResourceInvalidException("Unknown source-type: " + proto.getSourceType());
}
return FilterChainMatch.create(
proto.getDestinationPort().getValue(),
prefixRanges.build(),
ImmutableList.copyOf(proto.getApplicationProtocolsList()),
sourcePrefixRanges.build(),
sourceType,
ImmutableList.copyOf(proto.getSourcePortsList()),
ImmutableList.copyOf(proto.getServerNamesList()),
proto.getTransportProtocol());
}
@VisibleForTesting
static io.grpc.xds.HttpConnectionManager parseHttpConnectionManager(
HttpConnectionManager proto, FilterRegistry filterRegistry,
boolean isForClient, XdsResourceType.Args args) throws ResourceInvalidException {
if (proto.getXffNumTrustedHops() != 0) {
throw new ResourceInvalidException(View on GitHub (pinned to 64daddc1f3)