apache/beam · error
invalid status for combine merge %v: %v
Error message
invalid status for combine merge %v: %v
What it means
MergeAccumulators.ProcessElement (the GBK merge side of a combine) requires the node to be Active within a started bundle. Elements arriving while the node is in any other status indicate an out-of-order lifecycle invocation.
Source
Thrown at sdks/go/pkg/beam/core/runtime/exec/combine.go:577
}
c.cache = nil
return nil
}
// MergeAccumulators is an executor for merging accumulators from a lifted combine.
type MergeAccumulators struct {
*Combine
}
func (n *MergeAccumulators) String() string {
return fmt.Sprintf("MergeAccumulators[%v] Keyed:%v Out:%v", path.Base(n.Fn.Name()), n.UsesKey, n.Out.ID())
}
// ProcessElement accepts a stream of accumulator values with the same key and
// runs the MergeAccumulatorsFn over them repeatedly.
func (n *MergeAccumulators) ProcessElement(ctx context.Context, value *FullValue, values ...ReStream) error {
if n.status != Active {
return errors.Errorf("invalid status for combine merge %v: %v", n.UID, n.status)
}
n.Combine.states.Set(n.Combine.ctx, metrics.ProcessBundle)
a, err := n.newAccum(n.Combine.ctx, value.Elm)
if err != nil {
return n.fail(err)
}
first := true
stream, err := values[0].Open()
if err != nil {
return n.fail(err)
}
defer stream.Close()
for {
v, err := stream.Read()
if err != nil {
if err == io.EOF {
breakView on GitHub (pinned to 12126d8942)
Solutions
- Ensure StartBundle was called successfully before processing accumulator elements.
- Check for swallowed errors from earlier lifecycle calls (a failed StartBundle leaves status Up).
- Rebuild the plan node if its status is stale.
Defensive patterns
Strategy: validation
Try / catch
if err := merge.ProcessElement(ctx, fv, values); err != nil {
if strings.Contains(err.Error(), "invalid status for combine merge") {
// ensure the merge node was started (Up + StartBundle)
}
return err
} Prevention
- Verify StartBundle succeeded before streaming accumulators.
- Fail fast on earlier lifecycle errors instead of continuing to process.
- Use standard plan construction in tests.
When it happens
Trigger: Calling MergeAccumulators.ProcessElement before StartBundle or after FinishBundle.
Common situations: Tests feeding accumulator streams directly to the merge node; runners whose bundle-start step failed silently but continued to emit data.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- invalid status for precombine %v: %v
- invalid status for combine extract %v: %v
- invalid status for combine convert %v: %v
- invalid status for combine %v: %v
- unable to infer CombineFn accumulator coder
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/5abbd530afeb9dc0.
Report an issue: GitHub.