{"record":{"id":"5a51dfd65fd64a2b","repo":"apache/druid","slug":"failed-to-deserialize-thrift-data","errorCode":null,"errorMessage":"Failed to deserialize Thrift data","messagePattern":"Failed to deserialize Thrift data","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/thrift-extensions/src/main/java/org/apache/druid/data/input/thrift/ThriftReader.java","lineNumber":117,"sourceCode":"\n  @Override\n  protected List<Map<String, Object>> toMap(byte[] intermediateRow) throws IOException\n  {\n    return Collections.singletonList(toFlattenedMap(intermediateRow));\n  }\n\n  private Map<String, Object> toFlattenedMap(byte[] bytes) throws ParseException\n  {\n    try {\n      final Class<TBase> clazz = getThriftClass();\n      final TBase tbase = clazz.newInstance();\n      ThriftDeserialization.detectAndDeserialize(bytes, tbase);\n      final String json = ThriftDeserialization.SERIALIZER_SIMPLE_JSON.get().toString(tbase);\n      final JsonNode node = OBJECT_MAPPER.readTree(json);\n      return recordFlattener.flatten(node);\n    }\n    catch (TException | IOException e) {\n      throw new ParseException(null, e, \"Failed to deserialize Thrift data\");\n    }\n    catch (InstantiationException | IllegalAccessException e) {\n      throw new ParseException(null, e, \"Failed to instantiate Thrift class [%s]\", thriftClassName);\n    }\n    catch (ClassNotFoundException e) {\n      throw new ParseException(null, e, \"Thrift class [%s] not found\", thriftClassName);\n    }\n  }\n\n  @SuppressWarnings({\"unchecked\", \"ReturnValueIgnored\"})\n  private Class<TBase> getThriftClass() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException\n  {\n    if (thriftClass == null) {\n      final Class<TBase> clazz;\n      if (jarPath != null) {\n        File jar = new File(jarPath);\n        URLClassLoader child = new URLClassLoader(\n            new URL[]{jar.toURI().toURL()},","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/thrift-extensions/src/main/java/org/apache/druid/data/input/thrift/ThriftReader.java#L99-L135","documentation":"toFlattenedMap() wraps TException (raised by ThriftDeserialization.detectAndDeserialize when the bytes are not valid Thrift data in any supported protocol, or by JSON serialization) and IOException into a ParseException. It fires on malformed or schema-incompatible records in the input stream — the bytes cannot be read into the configured TBase.","triggerScenarios":"Thrown at extensions-contrib/thrift-extensions/src/main/java/org/apache/druid/data/input/thrift/ThriftReader.java:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the thriftClass setting points at a concrete generated TBase class, not an interface or abstract type","Confirm the generated Thrift class is compiled with a public no-arg constructor and is on the classpath","Regenerate the Thrift classes from the correct IDL if a wrong/legacy class is deployed"],"exampleFix":null,"handlingStrategy":"try-catch","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"}