apache/beam · error
error decoding single-precision float field
Error message
error decoding single-precision float field
What it means
Wrap added by reflectDecodeSinglePrecisionFloat when DecodeSinglePrecisionFloat fails pulling a 4-byte float from the row byte stream. It signals truncated or corrupt element data for a float32-typed field, or a coder mismatch between producer and consumer.
Solutions
- Confirm the data source is intact and produced by a compatible encoder.
- Re-encode the data.
- Verify reader/writer schemas match field-for-field.
- Check truncation at the failing offset.
Defensive patterns
Strategy: try-catch
Try / catch
if err := decoderFn(rv, r); err != nil {
if strings.Contains(err.Error(), "single-precision float") {
return fmt.Errorf("truncated float32 field in row: %w", err)
}
return err
} Prevention
- Ensure float32 fields are not altered to float64 (or vice versa) without schema migration.
- Verify encoded blob lengths match expected field sizes.
- Use checksums on stored outputs.
- Keep writer/reader Beam SDK versions compatible.
When it happens
Trigger: reflectDecodeSinglePrecisionFloat during row decoding when DecodeSinglePrecisionFloat cannot read 4 bytes — truncated input or misaligned decoding.
Common situations: Truncated output files, schema drift changing field layout, decoding data with mismatched coder versions.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- error decoding bool field
- error decoding double field
- error decoding single byte field
- error decoding string field
- error decoding varint field
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/2e843b6282e409cc.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/graph/coder/row_decoder.go:247
return errors.Wrap(err, "error decoding varint field")
}
rv.SetInt(v)
return nil
}
func reflectDecodeUint(rv reflect.Value, r io.Reader) error {
v, err := DecodeVarUint64(r)
if err != nil {
return errors.Wrap(err, "error decoding varint field")
}
rv.SetUint(v)
return nil
}
func reflectDecodeSinglePrecisionFloat(rv reflect.Value, r io.Reader) error {
v, err := DecodeSinglePrecisionFloat(r)
if err != nil {
return errors.Wrap(err, "error decoding single-precision float field")
}
rv.SetFloat(float64(v))
return nil
}
func reflectDecodeFloat(rv reflect.Value, r io.Reader) error {
v, err := DecodeDouble(r)
if err != nil {
return errors.Wrap(err, "error decoding double field")
}
rv.SetFloat(v)
return nil
}
func reflectDecodeByteSlice(rv reflect.Value, r io.Reader) error {
b, err := DecodeBytes(r)
if err != nil {
return errors.Wrap(err, "error decoding []byte field")View on GitHub (pinned to 12126d8942)