apache/beam · error · RuntimeException
Unable to parse schema for RowCoder:
Error message
Unable to parse schema for RowCoder:
What it means
When translating a RowCoder from its proto form, CoderTranslators.fromComponents parses the payload as a Schema protobuf; an InvalidProtocolBufferException is rethrown as RuntimeException('Unable to parse schema for RowCoder: '), meaning the coder payload bytes are corrupt or not a Schema message.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/CoderTranslators.java:181
public List<? extends Coder<?>> getComponents(RowCoder from) {
return ImmutableList.of();
}
@Override
public byte[] getPayload(RowCoder from) {
return SchemaTranslation.schemaToProto(from.getSchema(), true).toByteArray();
}
@Override
public RowCoder fromComponents(
List<Coder<?>> components, byte[] payload, CoderTranslation.TranslationContext context) {
checkArgument(
components.isEmpty(), "Expected empty component list, but received: " + components);
Schema schema;
try {
schema = SchemaTranslation.schemaFromProto(SchemaApi.Schema.parseFrom(payload));
} catch (InvalidProtocolBufferException e) {
throw new RuntimeException("Unable to parse schema for RowCoder: ", e);
}
return RowCoder.of(schema);
}
};
}
static <T> CoderTranslator<SchemaCoder<T>> schema() {
return new CoderTranslator<SchemaCoder<T>>() {
private static final String TO_ROW_FUNCTION_URN = "beam:torowfn:javasdk:v1";
private static final String FROM_ROW_FUNCTION_URN = "beam:fromrowfn:javasdk:v1";
private static final String TYPE_DESCRIPTOR_URN = "beam:typedescriptor:javasdk:v1";
@Override
public ImmutableList<? extends Coder<?>> getComponents(SchemaCoder<T> from) {
return ImmutableList.of();
}
@OverrideView on GitHub (pinned to 12126d8942)
Solutions
- Re-serialize the pipeline with the same Beam version used to run it; align SDK versions
- Verify the payload bytes are a valid SchemaApi.Schema protobuf (parse standalone to confirm)
- Regenerate the job graph rather than reusing stale/cached serialized pipelines
- If decode must be lenient, wrap and log payload hex to diagnose the exact corruption
Example fix
// before
schema = SchemaTranslation.schemaFromProto(SchemaApi.Schema.parseFrom(payload));
// after
try {
schema = SchemaTranslation.schemaFromProto(SchemaApi.Schema.parseFrom(payload));
} catch (InvalidProtocolBufferException e) {
throw new IOException("Unable to parse RowCoder schema payload (" + payload.length + " bytes)", e);
} Defensive patterns
Strategy: try-catch
Validate before calling
SchemaApi.Schema.parseFrom(payload); // throws InvalidProtocolBufferException if invalid
Try / catch
try {
return CoderTranslators.rowCoderFromProtoComponents(payload, components);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("Unable to parse schema for RowCoder")) {
throw new IOException("corrupt RowCoder payload; regenerate the pipeline proto", e);
}
throw e;
} Prevention
- Use the same Beam version to serialize and deserialize pipeline protos
- Never hand-edit binary job protos
- Detect payload truncation in transport layers (checksum)
When it happens
Trigger: Deserializing a pipeline/graph proto whose RowCoder spec payload was truncated, corrupted, or produced by an incompatible Beam version where the payload layout differs.
Common situations: Pipelines serialized by a different Beam SDK version and replayed with another; hand-edited or damaged job protos; transport layers that mangle binary payloads.
Understand the failure class
Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Missing serialized typeDescriptor
- Failed to convert PipelineOptions to JSON
- Internal error determining boundedness of Read
- Required field 'timestamp_transform' not set in %s
- Required field 'trigger' not set in %s
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/42e2f3799d20e51c.
Report an issue: GitHub.