{"record":{"id":"b33e32d9cab60178","repo":"apache/beam","slug":"error-decoding-payload-javaclasslookuptransformprovider","errorCode":null,"errorMessage":"Error decoding payload","messagePattern":"Error decoding payload","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/JavaClassLookupTransformProvider.java","lineNumber":623,"sourceCode":"        throw new IllegalArgumentException(\"Wildcard builder not allowed for non-wildcard class.\");\n      }\n      return new AutoValue_JavaClassLookupTransformProvider_AllowedClass(\n          className, allowedBuilderMethods, allowedConstructorMethods);\n    }\n  }\n\n  static Row decodeRow(SchemaApi.Schema schema, ByteString payload) {\n    Schema payloadSchema = SchemaTranslation.schemaFromProto(schema);\n\n    if (payloadSchema.getFieldCount() == 0) {\n      return Row.withSchema(Schema.of()).build();\n    }\n\n    Row row;\n    try {\n      row = RowCoder.of(payloadSchema).decode(payload.newInput());\n    } catch (IOException e) {\n      throw new RuntimeException(\"Error decoding payload\", e);\n    }\n    return row;\n  }\n}\n","sourceCodeStart":605,"sourceCodeEnd":628,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/JavaClassLookupTransformProvider.java#L605-L628","documentation":"decodeRow wraps IOException from RowCoder.of(payloadSchema).decode in a RuntimeException 'Error decoding payload': the byte payload could not be decoded into a Row matching payloadSchema (corrupt/truncated bytes or schema mismatch).","triggerScenarios":"Decoding a FunctionSpec payload (constructorRow/builderMethodRow) when payload bytes were produced with a different schema, truncated in transport, or encoded by an incompatible SDK version.","commonSituations":"Version skew between client SDK and expansion service; hand-built or edited payloads; schema drift after Beam upgrade.","solutions":["Ensure client SDK and expansion service use the same Beam version so payload schemas match.","Inspect the chained IOException cause for the exact decode failure.","Re-encode the payload with RowCoder.of(payloadSchema) on the client and retry.","Log payload size and schema field names on both sides to spot truncation/schema drift."],"exampleFix":"// before\nRow row = RowCoder.of(oldSchema).decode(payload.newInput());\n// after\nRow row = RowCoder.of(payloadSchema).decode(payload.newInput()); // matching encoder schema","handlingStrategy":"try-catch","validationCode":"if (payload == null || payload.size() == 0) throw new IllegalArgumentException(\"Empty payload for row decode\");","typeGuard":null,"tryCatchPattern":"try { Row row = decodeRow(payload); } catch (RuntimeException e) { log.error(\"Payload decode failed (size=\" + payload.size() + \")\", e); throw new PayloadDecodeException(e); }","preventionTips":["Pin identical Beam versions on client and service","Add integration tests round-tripping payloads through the coder","Check schema compatibility when upgrading Beam","Never hand-edit serialized payloads"],"tags":["decoding","serialization","grpc"],"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-14T16:17:12.679Z"}