grpc/grpc-java · error · IllegalArgumentException
Unknown Value type:
Error message
Unknown Value type:
What it means
ProtobufJsonConverter.convertValue converts a google.protobuf.Value into a plain Java object by switching on the Value's kind case. When the kind is not a recognized case (struct/list/number/string/bool/null), it throws an IllegalArgumentException naming the KindCase. This indicates a malformed or unsupported protobuf Value.
Solutions
- Ensure every google.protobuf.Value in the source config has exactly one kind set
- Fix the config producer that emitted the unset Value
- Upgrade the protobuf/grpc-xds libraries if a new Value kind is involved
- Add upstream validation rejecting Values with KIND_NOT_SET
Example fix
// before: Value with no kind set
Value.newBuilder().build()
// after
Value.newBuilder().setStringValue("prod").build() Defensive patterns
Strategy: validation
Validate before calling
if (value.getKindCase() == Value.KindCase.KIND_NOT_SET) { reject("Value has no kind set"); } Type guard
null
Try / catch
try { json = ProtobufJsonConverter.convertToJson(struct); }
catch (IllegalArgumentException e) { log.error("Unsupported Value kind", e); treatAsEmpty(); } Prevention
- Always set exactly one kind field on google.protobuf.Value
- Keep protobuf runtime versions consistent
- Validate metadata in config before distribution
When it happens
Trigger: convertToJson encounters a google.protobuf.Value whose kind is KIND_NOT_SET or an unrecognized case from a newer protobuf API version.
Common situations: Proto built without setting any kind field; custom metadata in xDS config carrying an unset Value; protobuf runtime version mismatch between producer and consumer.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- ${structOrError.getErrorDetail()}
- ClusterSpecifierPlugin
- Could not parse HttpConnectionManager config from…
- Failed to parse access token credentials: " + e.getMessage()
- Failed to parse channel credentials: " + e.getMessage()
AI-assisted analysis of grpc/grpc-java@64daddc1f3 (2026-09-08).
Data as JSON: /api/errors/dced9cf63fbdc5da.
Report an issue: GitHub.
Appendix: source
Thrown at xds/src/main/java/io/grpc/xds/internal/ProtobufJsonConverter.java:58
private static Object convertValue(Value value) {
switch (value.getKindCase()) {
case STRUCT_VALUE:
return convertToJson(value.getStructValue());
case LIST_VALUE:
return value.getListValue().getValuesList().stream()
.map(ProtobufJsonConverter::convertValue)
.collect(Collectors.toList());
case NUMBER_VALUE:
return value.getNumberValue();
case STRING_VALUE:
return value.getStringValue();
case BOOL_VALUE:
return value.getBoolValue();
case NULL_VALUE:
return null;
default:
throw new IllegalArgumentException("Unknown Value type: " + value.getKindCase());
}
}
}
View on GitHub (pinned to 64daddc1f3)