apache/beam · error
bad iterable/stream: %+v
Error message
bad iterable/stream: %+v
What it means
DecodeCoderRef converts stream-type refs (iterables) back into coders. A stream ref must have exactly one component (the element coder); any other count is malformed, so decoding fails with the ref printed in the message.
Solutions
- Regenerate the pipeline artifact from the original pipeline so stream coders are re-encoded correctly.
- Match SDK versions between the encoder and decoder of the pipeline graph.
- Check custom graph-mutation passes for edits to stream/iterable coder component lists.
- Inspect the printed CoderRef to trace which transform's coder is malformed.
Example fix
// before
ref := &graphx.CoderRef{Type: graphx.Stream, Components: nil}
c, err := graphx.DecodeCoderRef(ref)
// after
ref := &graphx.CoderRef{Type: graphx.Stream, Components: []*graphx.CoderRef{elemRef}}
c, err := graphx.DecodeCoderRef(ref) Defensive patterns
Strategy: try-catch
Validate before calling
func validStreamRef(r *graphx.CoderRef) bool {
return r != nil && r.Type == graphx.Stream && len(r.Components) == 1
} Type guard
func isStreamRef(r *graphx.CoderRef) bool { return r != nil && r.Type == graphx.Stream && len(r.Components) == 1 } Try / catch
c, err := graphx.DecodeCoderRef(ref)
if err != nil {
if strings.Contains(err.Error(), "bad iterable/stream") {
return nil, fmt.Errorf("stream ref needs exactly 1 element component %v: %w", ref, err)
}
return nil, err
} Prevention
- Round-trip test iterable coders in unit tests
- Never mutate CoderRef component slices in graph tooling
- Re-encode pipelines after any SDK version change
When it happens
Trigger: Decoding a CoderRef with Type streamType whose Components has length != 1 — during deserialization of a pipeline graph or job description containing a corrupted or foreign-encoded iterable coder.
Common situations: Pipeline artifacts produced by different SDK versions; custom graph rewriters duplicating element components; truncated or hand-edited proto/json pipelines; GBK output graphs decoded with mismatched tooling.
Related errors
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/f1921aef0786b42f.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/runtime/graphx/dataflow.go:333
if len(c.Components) != 2 {
return nil, errors.Errorf("bad windowed value: %+v", c)
}
elm, err := DecodeCoderRef(c.Components[0])
if err != nil {
return nil, err
}
w, err := decodeWindowCoder(c.Components[1])
if err != nil {
return nil, err
}
t := typex.New(typex.WindowedValueType, elm.T)
return &coder.Coder{Kind: coder.WindowedValue, T: t, Components: []*coder.Coder{elm}, Window: w}, nil
case streamType:
if len(c.Components) != 1 {
return nil, errors.Errorf("bad iterable/stream: %+v", c)
}
inner, err := DecodeCoderRef(c.Components[0])
if err != nil {
return nil, err
}
t := typex.New(reflect.SliceOf(inner.T.Type()), inner.T)
return &coder.Coder{Kind: coder.Iterable, T: t, Components: []*coder.Coder{inner}}, nil
case rowType:
subC := c.Components[0]
schm := &pipepb.Schema{}
if err := protox.DecodeBase64(subC.Type, schm); err != nil {
return nil, err
}
t, err := schema.ToType(schm)
if err != nil {View on GitHub (pinned to 12126d8942)