apache/beam · error · java.lang.RuntimeException
Failed to get field from proto. field
Error message
Failed to get field from proto. field: %s
What it means
FromProtoGetter.getFromProto reads a field value off a proto Message and converts it to a Beam value. Any RuntimeException raised while reading/converting the field is wrapped in a RuntimeException identifying the schema field name, so the original cause (type mismatch, null handling, converter failure) is preserved as the cause chain.
Solutions
- Read the cause of the wrapped RuntimeException to find the actual failure
- Verify the proto Message class and descriptor match the schema the converter was built from
- Rebuild the schema/converter after changing the proto definition (stale descriptors are common)
- Log field.getName() and check the offending field's type/optional-ness
Example fix
// before
Row row = ProtoUtils.rowFromMessage(msg); // throws 'Failed to get field from proto. field: foo'
// after
try { Row row = ProtoUtils.rowFromMessage(msg); } catch (RuntimeException e) { LOG.error("field {} failed: ", e.getCause()); } Defensive patterns
Strategy: try-catch
Validate before calling
// ensure message descriptor matches the one used to build the schema
if (!message.getDescriptorForType().getFullName().equals(expectedDescriptor.getFullName())) throw new IllegalStateException("descriptor mismatch"); Try / catch
try { Row row = converter.apply(message); } catch (RuntimeException e) { LOG.error("proto->Beam failed on field {}, cause: {}", e.getMessage(), e.getCause()); throw e; } Prevention
- Regenerate schemas whenever protos change
- Log e.getCause() — the wrapper hides the real error
- Use a single FileDescriptor source for both schema and runtime messages
When it happens
Trigger: Calling getFromProto during proto-to-Beam Row conversion when message.getField(fieldDescriptor) or the field's converter throws (e.g. field descriptor not found on the message, conversion type error).
Common situations: Schema/proto descriptor drift (message class changed after schema was built); passing a Message instance that doesn't match the descriptor; a custom converter for the field failing.
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.
Related errors
- Failed to set field to proto. field
- Failed to get oneof from proto. oneof
- Failed to set oneof to proto. oneof
- bad type: , want
- base64 decode for failed
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/348f38ce404ca4b3.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoBeamConverter.java:412
Descriptors.Descriptor descriptor = message.getDescriptorForType();
Descriptors.FieldDescriptor fieldDescriptor =
Preconditions.checkNotNull(descriptor.findFieldByName(field.getName()));
@Nullable Object protoValue;
if (field.getType().getNullable()
&& ProtoSchemaTranslator.isNullable(fieldDescriptor)
&& !message.hasField(fieldDescriptor)) {
// Set null field value only if the Beam field type is nullable and the proto value is
// null,
protoValue = null;
} else {
// can be a default value. e.g., an optional field.
protoValue = message.getField(fieldDescriptor);
}
return protoValue != null ? converter.convert((@NonNull ProtoT) protoValue) : null;
} catch (RuntimeException e) {
throw new RuntimeException(
String.format("Failed to get field from proto. field: %s", field.getName()), e);
}
}
}
static class FromProtoOneOfGetter implements FromProtoGetter<OneOfType.@Nullable Value> {
private final Schema.Field field;
private final OneOfType oneOfType;
private final Map<String, ProtoToBeamConverter<Object, Object>> converter;
FromProtoOneOfGetter(Schema.Field field) {
this.field = field;
this.oneOfType = Preconditions.checkNotNull(field.getType().getLogicalType(OneOfType.class));
this.converter = createConverters(oneOfType.getOneOfSchema());
}
private static Map<String, ProtoToBeamConverter<Object, Object>> createConverters(
Schema schema) {View on GitHub (pinned to 12126d8942)