{"record":{"id":"32e2be997e6257aa","repo":"apache/beam","slug":"invalid-status-for-combine-v-v","errorCode":null,"errorMessage":"invalid status for combine %v: %v","messagePattern":"invalid status for combine (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/combine.go","lineNumber":71,"sourceCode":"\taiValConvert func(any) any\n\n\tstates *metrics.PTransformState\n}\n\n// GetPID returns the PTransformID for this CombineFn.\nfunc (n *Combine) GetPID() string {\n\treturn n.PID\n}\n\n// ID returns the UnitID for this node.\nfunc (n *Combine) ID() UnitID {\n\treturn n.UID\n}\n\n// Up initializes this CombineFn and runs its SetupFn() method.\nfunc (n *Combine) Up(ctx context.Context) error {\n\tif n.status != Initializing {\n\t\treturn errors.Errorf(\"invalid status for combine %v: %v\", n.UID, n.status)\n\t}\n\tn.status = Up\n\n\tn.states = metrics.NewPTransformState(n.PID)\n\n\tif _, err := InvokeWithoutEventTime(ctx, n.Fn.SetupFn(), nil, nil, nil, nil, nil); err != nil {\n\t\treturn n.fail(err)\n\t}\n\n\tif ca := n.Fn.CreateAccumulatorFn(); ca != nil {\n\t\tn.createAccumInv = newInvoker(ca)\n\t}\n\tif ai := n.Fn.AddInputFn(); ai != nil {\n\t\tn.addInputInv = newInvoker(ai)\n\t} else {\n\t\tn.optimizeMergeFn()\n\t}\n\tn.mergeInv = newInvoker(n.Fn.MergeAccumulatorsFn())","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/combine.go#L53-L89","documentation":"Combine.Up enforces the lifecycle state machine: the node must be in the Initializing status when Up is called. Calling Up on an already-initialized Combine (status Up, Active, etc.) indicates the bundle lifecycle methods are being invoked out of order or more than once.","triggerScenarios":"Calling Up twice on the same Combine unit, or calling Up after StartBundle/FinishBundle without re-initialization.","commonSituations":"Custom runner code or tests building a plan and invoking lifecycle methods manually; runner bugs that re-up a cached plan without resetting node status.","solutions":["Call each lifecycle method exactly once and in order: Up, StartBundle, ProcessElement(s), FinishBundle.","Reset status to Initializing (construct a fresh Combine) before calling Up again.","Check for runner code paths that re-invoke Up on a shared plan instance."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// guard before calling Up\n// Combine has no exported status field; drive lifecycle through plan.Execute instead of direct calls.","typeGuard":null,"tryCatchPattern":"if err := combine.Up(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"invalid status for combine\") {\n\t\t// the node was already initialized; rebuild the plan instead of re-upping\n\t}\n\treturn err\n}","preventionTips":["Never call Up twice on the same unit; build a fresh plan instead.","Rely on the standard plan executor to drive lifecycle methods.","In tests, mirror the exact order: Up, StartBundle, ProcessElement, FinishBundle."],"tags":["go","beam","lifecycle","state-machine"],"backgroundTag":"invalid-state-transition","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}