{"record":{"id":"a2bb63a8db9f3372","repo":"apache/beam","slug":"while-executing-startbundle-for-v","errorCode":null,"errorMessage":"while executing StartBundle for %v","messagePattern":"while executing StartBundle for (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/plan.go","lineNumber":146,"sourceCode":"\t\t\t}\n\t\t}\n\t\tp.setStatus(Up)\n\t}\n\tif p.source != nil {\n\t\tp.source.InitSplittable()\n\t}\n\n\tif s := p.getStatus(); s != Up {\n\t\treturn errors.Errorf(\"invalid status for plan %v: %v\", p.id, s)\n\t}\n\n\t// Process bundle. If there are any kinds of failures, we bail and mark the plan broken.\n\n\tp.setStatus(Active)\n\tfor _, root := range p.roots {\n\t\tif err := callNoPanic(ctx, func(ctx context.Context) error { return root.StartBundle(ctx, id, manager) }); err != nil {\n\t\t\tp.setStatus(Broken)\n\t\t\treturn errors.Wrapf(err, \"while executing StartBundle for %v\", p)\n\t\t}\n\t}\n\tfor _, root := range p.roots {\n\t\tif err := callNoPanic(ctx, func(ctx context.Context) error {\n\t\t\tcps, err := root.Process(ctx)\n\t\t\tp.checkpoints = cps\n\t\t\treturn err\n\t\t}); err != nil {\n\t\t\tp.setStatus(Broken)\n\t\t\treturn errors.Wrapf(err, \"while executing Process for %v\", p)\n\t\t}\n\t}\n\tfor _, root := range p.roots {\n\t\tif err := callNoPanic(ctx, root.FinishBundle); err != nil {\n\t\t\tp.setStatus(Broken)\n\t\t\treturn errors.Wrapf(err, \"while executing FinishBundle for %v\", p)\n\t\t}\n\t}","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/plan.go#L128-L164","documentation":"During bundle processing, Plan.Execute calls StartBundle on each root unit; if any root fails, the plan is marked Broken and this wrapped error is returned. The underlying cause is typically the ParDo.StartBundle status error (5001) or a DoFn StartBundle hook failure.","triggerScenarios":"A root unit's StartBundle returning an error: DoFn @StartBundle callback panics or fails, status is not Up, or the DataContext provides invalid reader/timer state.","commonSituations":"DoFn StartBundle hooks with side effects failing (bad client init, missing config); executing a bundle on a plan whose Up failed silently in a prior step; test harnesses supplying nil DataContext fields.","solutions":["Unwrap the returned error to identify the failing root unit and its actual failure cause.","Fix the DoFn StartBundle hook: it must succeed for every bundle; verify any external clients/config it initializes.","Rebuild the plan after the failure - Broken plans cannot process further bundles."],"exampleFix":"// before\nif err := plan.Execute(ctx, id, mgr); err != nil { return err }\n// after\nif err := plan.Execute(ctx, id, mgr); err != nil {\n    if strings.Contains(err.Error(), \"StartBundle\") {\n        log.Printf(\"bundle start failed: %v\", err) // inspect DoFn StartBundle hook\n    }\n    return err\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := plan.Execute(ctx, id, mgr); err != nil {\n    if strings.Contains(err.Error(), \"StartBundle\") {\n        log.Printf(\"DoFn StartBundle hook failed: %v\", err) // unwrap for root cause\n    }\n    return err\n}","preventionTips":["Keep DoFn @StartBundle hooks idempotent and error-checked (clients, config).","Supply a valid DataContext (reader, timer manager) when executing bundles.","After a StartBundle failure, discard the plan - it is Broken."],"tags":["go","apache-beam","bundle","wrapped-error"],"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-20T03:17:13.778Z"}