{"record":{"id":"954cd7a440fca575","repo":"apache/beam","slug":"incorrect-thrift-protocol-factory-class-provided-s","errorCode":null,"errorMessage":"Incorrect thrift protocol factory class provided: %s","messagePattern":"Incorrect thrift protocol factory class provided: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/thrift/src/main/java/org/apache/beam/sdk/io/thrift/ThriftPayloadSerializerProvider.java","lineNumber":63,"sourceCode":"\n  private static Class<? extends TBase> getMessageClass(Map<String, Object> tableParams) {\n    String thriftClassName = checkArgumentNotNull(tableParams.get(\"thriftClass\")).toString();\n    try {\n      Class<?> thriftClass = Class.forName(thriftClassName);\n      return thriftClass.asSubclass(TBase.class);\n    } catch (ClassNotFoundException e) {\n      throw new IllegalArgumentException(\"Incorrect thrift class provided: \" + thriftClassName, e);\n    }\n  }\n\n  private static TProtocolFactory getProtocolFactory(Map<String, Object> tableParams) {\n    String thriftFactoryClassName =\n        checkArgumentNotNull(tableParams.get(\"thriftProtocolFactoryClass\")).toString();\n    try {\n      Class<?> thriftClass = Class.forName(thriftFactoryClassName);\n      return thriftClass.asSubclass(TProtocolFactory.class).getDeclaredConstructor().newInstance();\n    } catch (ReflectiveOperationException e) {\n      throw new IllegalArgumentException(\n          \"Incorrect thrift protocol factory class provided: \" + thriftFactoryClassName, e);\n    }\n  }\n\n  private static void inferAndVerifySchema(Class<?> thriftClass, Schema requiredSchema) {\n    TypeDescriptor<?> typeDescriptor = TypeDescriptor.of(thriftClass);\n    Schema schema = checkArgumentNotNull(ThriftSchema.provider().schemaFor(typeDescriptor));\n    if (!schema.assignableTo(requiredSchema)) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Given message schema: '%s'%n\"\n                  + \"does not match schema inferred from thrift class.%n\"\n                  + \"Thrift class: '%s'%n\"\n                  + \"Inferred schema: '%s'\",\n              requiredSchema, thriftClass.getName(), schema));\n    }\n  }\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/thrift/src/main/java/org/apache/beam/sdk/io/thrift/ThriftPayloadSerializerProvider.java#L45-L81","documentation":"ThriftPayloadSerializerProvider.getProtocolFactory loads the 'thriftProtocolFactoryClass' parameter via reflection and instantiates it with a no-arg constructor. Any ReflectiveOperationException (class not found, not a TProtocolFactory, missing/inaccessible constructor) becomes an IllegalArgumentException with this message.","triggerScenarios":"Passing a thriftProtocolFactoryClass that doesn't exist on the classpath, names a class that doesn't implement TProtocolFactory, or has no public no-arg constructor.","commonSituations":"Typo like 'TBinaryProtocol$Factory' mis-spelled; passing the protocol class (TBinaryProtocol) instead of its Factory; class present locally but missing on worker nodes.","solutions":["Use a TProtocolFactory implementation with a public no-arg constructor, e.g. org.apache.thrift.protocol.TBinaryProtocol$Factory or TCompactProtocol$Factory","Make sure you reference the nested Factory class, not the protocol class itself","Stage the dependency jar on workers so Class.forName succeeds on every node"],"exampleFix":"// before\nparams.put(\"thriftProtocolFactoryClass\", \"org.apache.thrift.protocol.TBinaryProtocol\"); // not a factory\n// after\nparams.put(\"thriftProtocolFactoryClass\", \"org.apache.thrift.protocol.TBinaryProtocol$Factory\");","handlingStrategy":"validation","validationCode":"Class<?> c = Class.forName(factoryName); if (!TProtocolFactory.class.isAssignableFrom(c)) { throw new IllegalArgumentException(factoryName + \" is not a TProtocolFactory\"); } c.getDeclaredConstructor();","typeGuard":null,"tryCatchPattern":"try { io = ThriftIO.read().withParams(params); } catch (IllegalArgumentException e) { throw new IllegalStateException(\"Check thriftProtocolFactoryClass (must be a TProtocolFactory with no-arg ctor)\", e); }","preventionTips":["Reference the $Factory nested class, never the protocol class itself","Keep allowed factory names in an enum/constant list","Verify the factory jar is bundled for workers"],"tags":["java","thrift","reflection","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}