apache/druid · error · QueryDriver.RequestError
Could not write value
Error message
Could not write value [%s] to field [%s]
What it means
ProtobufWriter.writeRowField uses reflection to call Builder.setField, and the reflective invocation failed (IllegalAccessException or the underlying setter threw, e.g. type mismatch). The value produced for a column cannot be written into the corresponding protobuf field, so a QueryDriver.RequestError is raised to surface a result-encoding failure to the client.
Solutions
- Inspect the wrapped InvocationTargetException for the setter's real failure — usually a value/field type mismatch.
- Ensure the SQL column types are compatible with the declared .proto field types (e.g. int64 vs int32, string vs bytes).
- Handle nulls and unsupported Java types before invoking setField.
- Catch QueryDriver.RequestError at the server layer to return a descriptive gRPC error status.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at extensions-contrib/grpc-query/src/main/java/org/apache/druid/grpc/server/ProtobufWriter.java:120 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/1bb374eef6a3b2fa.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-contrib/grpc-query/src/main/java/org/apache/druid/grpc/server/ProtobufWriter.java:120
message.getClass()
);
}
final Method method = methods.computeIfAbsent("setField", k -> {
try {
return rowBuilder
.getClass()
.getMethod(
"setField", new Class<?>[]{Descriptors.FieldDescriptor.class, Object.class});
}
catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
});
try {
method.invoke(rowBuilder, fieldDescriptor, value);
}
catch (IllegalAccessException | InvocationTargetException e) {
throw new QueryDriver.RequestError(
"Could not write value [%s] to field [%s]",
value,
name
);
}
}
@Override
public void writeRowEnd() throws IOException
{
Message rowMessage = rowBuilder.build();
rowMessage.writeDelimitedTo(outputStream);
}
@Override
public void writeResponseEnd()
{
}View on GitHub (pinned to 9b90983fd2)