{"record":{"id":"5ee270f6000489ba","repo":"apache/beam","slug":"invalid-payload-type-for-urn","errorCode":null,"errorMessage":"Invalid payload type for URN ","messagePattern":"Invalid payload type for URN ","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/ExpansionServiceSchemaTransformProvider.java","lineNumber":105,"sourceCode":"    for (String key : output.getAll().keySet()) {\n      pCollectionMap.put(key, output.get(key));\n    }\n    return pCollectionMap.build();\n  }\n\n  @Override\n  public PTransform getTransform(FunctionSpec spec, PipelineOptions options) {\n    SchemaTransformPayload payload;\n    try {\n      payload = SchemaTransformPayload.parseFrom(spec.getPayload());\n      String identifier = payload.getIdentifier();\n      if (!schemaTransformProviders.containsKey(identifier)) {\n        throw new RuntimeException(\n            \"Did not find a SchemaTransformProvider with the identifier \" + identifier);\n      }\n\n    } catch (InvalidProtocolBufferException e) {\n      throw new IllegalArgumentException(\n          \"Invalid payload type for URN \" + getUrn(ExpansionMethods.Enum.SCHEMA_TRANSFORM), e);\n    }\n\n    String identifier = payload.getIdentifier();\n    org.apache.beam.sdk.schemas.transforms.SchemaTransformProvider provider =\n        schemaTransformProviders.get(identifier);\n    if (provider == null) {\n      throw new IllegalArgumentException(\n          \"Could not find a SchemaTransform with identifier \" + identifier);\n    }\n\n    Schema configSchemaFromRequest =\n        SchemaTranslation.schemaFromProto(payload.getConfigurationSchema());\n    Schema configSchemaFromProvider = provider.configurationSchema();\n\n    if (!configSchemaFromRequest.assignableTo(configSchemaFromProvider)) {\n      throw new IllegalArgumentException(\n          String.format(","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/ExpansionServiceSchemaTransformProvider.java#L87-L123","documentation":"getTransform attempts SchemaTransformPayload.parseFrom(spec.getPayload()) and, if the bytes are not a valid SchemaTransformPayload protobuf (InvalidProtocolBufferException), throws IllegalArgumentException with this message. It indicates the FunctionSpec payload was built for a different payload type or is corrupt.","triggerScenarios":"An expansion request for the SCHEMA_TRANSFORM URN whose spec payload is not serialized SchemaTransformPayload — e.g., payload produced by a different expansion method (JavaClassLookupPayload) or by a mismatched Beam/proto version.","commonSituations":"Cross-version client/server where the payload proto changed; custom runner sending the wrong payload bytes for the URN; hand-crafted FunctionSpec with wrong payload.","solutions":["Ensure the client uses the matching Beam SDK version to construct the FunctionSpec so the payload is SchemaTransformPayload","Verify the URN actually corresponds to SCHEMA_TRANSFORM expansion (not JAVA_CLASS_LOOKUP or another method that expects a different payload)","Regenerate the request with the standard Beam transform expansion path instead of manual protobuf construction"],"exampleFix":"// before\nFunctionSpec.newBuilder().setUrn(urn).setPayload(javaClassLookupPayload.toByteString())\n// after\nFunctionSpec.newBuilder().setUrn(urn).setPayload(SchemaTransformPayload.newBuilder().setIdentifier(id)...build().toByteString())","handlingStrategy":"type-guard","validationCode":"// Ensure payload type matches URN before sending:\nassert spec.getUrn().equals(getUrn(ExpansionMethods.Enum.SCHEMA_TRANSFORM));","typeGuard":null,"tryCatchPattern":"try { expanded = service.expand(request); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Invalid payload type for URN\")) { /* rebuild request payload */ } throw e; }","preventionTips":["Construct FunctionSpec payloads through the Beam SDK, never by hand","Keep client and service Beam versions in sync"],"tags":["java","protobuf","payload"],"backgroundTag":"protobuf-unmarshal-failed","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"}