{"record":{"id":"b4f03e50527ba430","repo":"apache/beam","slug":"incorrect-proto-class-provided-protoclassname","errorCode":null,"errorMessage":"Incorrect proto class provided: ${protoClassName}","messagePattern":"Incorrect proto class provided: (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoPayloadSerializerProvider.java","lineNumber":49,"sourceCode":"import org.apache.beam.sdk.transforms.SimpleFunction;\nimport org.apache.beam.sdk.values.Row;\nimport org.apache.beam.sdk.values.TypeDescriptor;\n\n@Internal\n@AutoService(PayloadSerializerProvider.class)\npublic class ProtoPayloadSerializerProvider implements PayloadSerializerProvider {\n  @Override\n  public String identifier() {\n    return \"proto\";\n  }\n\n  private static Class<? extends Message> getClass(Map<String, Object> tableParams) {\n    String protoClassName = checkArgumentNotNull(tableParams.get(\"protoClass\")).toString();\n    try {\n      Class<?> protoClass = Class.forName(protoClassName);\n      return protoClass.asSubclass(Message.class);\n    } catch (ClassNotFoundException e) {\n      throw new IllegalArgumentException(\"Incorrect proto class provided: \" + protoClassName, e);\n    }\n  }\n\n  private static <T extends Message> void inferAndVerifySchema(\n      Class<T> protoClass, Schema requiredSchema) {\n    @Nonnull\n    Schema inferredSchema =\n        checkArgumentNotNull(new ProtoMessageSchema().schemaFor(TypeDescriptor.of(protoClass)));\n    if (!inferredSchema.assignableTo(requiredSchema)) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Given message schema: '%s'%n\"\n                  + \"does not match schema inferred from protobuf class.%n\"\n                  + \"Protobuf class: '%s'%n\"\n                  + \"Inferred schema: '%s'\",\n              requiredSchema, protoClass.getName(), inferredSchema));\n    }\n  }","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoPayloadSerializerProvider.java#L31-L67","documentation":"ProtoPayloadSerializerProvider reads a 'protoClass' parameter naming a protobuf Message subclass; if Class.forName cannot load that class, it throws this IllegalArgumentException wrapping the ClassNotFoundException.","triggerScenarios":"Configuring a table/serializer with params {\"protoClass\": \"com.example.MyProto\"} where the class name is misspelled, the class is not on the classpath, or the jar containing generated protos is missing from the worker.","commonSituations":"Typo or wrong package in config; fat jar not bundling the generated proto classes; class present in dev but not staged to runners (Dataflow/Spark/Flink workers); refactoring moved/renamed the proto class.","solutions":["Correct the fully-qualified class name in the protoClass parameter.","Ensure the jar containing the generated proto class is on the classpath and staged to workers.","Use Class.forName locally in a startup check to validate the name early.","If the class was renamed/moved, update the configuration."],"exampleFix":"// before\n\"protoClass\": \"com.example.MyProoto$MyMsg\"\n// after\n\"protoClass\": \"com.example.MyProto$MyMsg\"","handlingStrategy":"validation","validationCode":"try {\n  Class.forName(protoClassName).asSubclass(com.google.protobuf.Message.class);\n} catch (ClassNotFoundException e) {\n  throw new IllegalArgumentException(\"protoClass not on classpath: \" + protoClassName);\n}","typeGuard":null,"tryCatchPattern":"try { serializer = provider.getSerializer(params); } catch (IllegalArgumentException e) { log.error(\"bad protoClass config: {}\", e.getMessage()); }","preventionTips":["Validate protoClass with Class.forName at config load time.","Keep the fully-qualified name in sync after refactors.","Ensure generated proto jars are bundled and staged to workers."],"tags":["java","protobuf","classpath","config"],"backgroundTag":"class-not-found","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"}