{"record":{"id":"37edfe2dbfe50962","repo":"apache/druid","slug":"field-s-not-found-in-protobuf-s","errorCode":null,"errorMessage":"Field [%s] not found in Protobuf [%s]","messagePattern":"Field \\[(.+?)\\] not found in Protobuf \\[(.+?)\\]","errorType":"error_code","errorClass":"QueryDriver.RequestError","httpStatus":null,"severity":"error","filePath":"extensions-contrib/grpc-query/src/main/java/org/apache/druid/grpc/server/ProtobufWriter.java","lineNumber":99,"sourceCode":"\n  @Override\n  public void writeRowStart()\n  {\n    rowBuilder = message.getDefaultInstanceForType().newBuilderForType();\n  }\n\n  @Override\n  public void writeRowField(String name, @Nullable Object value)\n  {\n    if (value == null) {\n      return;\n    }\n    final Descriptors.FieldDescriptor fieldDescriptor =\n        message.getDescriptorForType().findFieldByName(name);\n    // we should throw an exception if fieldDescriptor is null\n    // this means the .proto fields don't match returned column names\n    if (fieldDescriptor == null) {\n      throw new QueryDriver.RequestError(\n          \"Field [%s] not found in Protobuf [%s]\",\n          name,\n          message.getClass()\n      );\n    }\n    final Method method = methods.computeIfAbsent(\"setField\", k -> {\n      try {\n        return rowBuilder\n            .getClass()\n            .getMethod(\n                \"setField\", new Class<?>[]{Descriptors.FieldDescriptor.class, Object.class});\n      }\n      catch (NoSuchMethodException e) {\n        throw new RuntimeException(e);\n      }\n    });\n    try {\n      method.invoke(rowBuilder, fieldDescriptor, value);","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/grpc-query/src/main/java/org/apache/druid/grpc/server/ProtobufWriter.java#L81-L117","documentation":"ProtobufWriter.writeRowField could not resolve a field descriptor for a result column name: the .proto schema of the response message has no field matching that column. The writer raises a QueryDriver.RequestError (a client-facing error) because the SQL result columns and the declared protobuf schema are out of sync.","triggerScenarios":"Thrown at extensions-contrib/grpc-query/src/main/java/org/apache/druid/grpc/server/ProtobufWriter.java:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Compare the .proto definition of the query result message with the SQL query's output columns; align names (case included) and types.","Update the .proto file and regenerate the protobuf classes if the query results changed.","Catch QueryDriver.RequestError at the server layer to return a proper gRPC error status to the client.","Add a schema test that executes representative queries and validates every column maps to a proto field."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}