apache/beam · error

error decoding bool field

Error message

error decoding bool field

What it means

Wraps an error from DecodeBool while decoding a bool field of a schema-coded row, then sets the field value. It indicates the underlying byte stream was corrupt, truncated, or misaligned at the position of a bool field.

Solutions

  1. Verify the source data is complete and produced by a matching Beam row encoder.
  2. Re-encode the input data with the current schema/coder.
  3. Check field order/schema evolution compatibility between writer and reader.
  4. Log the row offset and inspect the raw bytes for corruption.
Defensive patterns

Strategy: try-catch

Try / catch

if err := decoderFn(rv, r); err != nil {
    if strings.Contains(err.Error(), "error decoding bool field") {
        return fmt.Errorf("row corrupt or truncated at bool field (offset %d): %w", offset, err)
    }
    return err
}

Prevention

When it happens

Trigger: reflectDecodeBool invoked during row decoding when DecodeBool cannot read a valid bool byte: EOF mid-row, corrupt/truncated input, or decoding data written with a different coder.

Common situations: Reading truncated files or messages, cross-version data where field layouts shifted, feeding non-Beam-encoded bytes into a Beam row decoder.

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


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/1272caa7c642aae0. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/core/graph/coder/row_decoder.go:202

			if IsFieldNil(nils, i) {
				continue
			}
			fv := rv.Field(i)
			if f.addr {
				fv = fv.Addr()
			}
			if err := f.decode(fv, r); err != nil {
				return err
			}
		}
		return nil
	}, nil
}

func reflectDecodeBool(rv reflect.Value, r io.Reader) error {
	v, err := DecodeBool(r)
	if err != nil {
		return errors.Wrap(err, "error decoding bool field")
	}
	rv.SetBool(v)
	return nil
}

func reflectDecodeByte(rv reflect.Value, r io.Reader) error {
	b, err := DecodeByte(r)
	if err != nil {
		return errors.Wrap(err, "error decoding single byte field")
	}
	rv.SetUint(uint64(b))
	return nil
}

func reflectDecodeString(rv reflect.Value, r io.Reader) error {
	v, err := DecodeStringUTF8(r)
	if err != nil {
		return errors.Wrap(err, "error decoding string field")

View on GitHub (pinned to 12126d8942)