{"record":{"id":"e6f5d20dab4b053d","repo":"apache/beam","slug":"while-executing-process-for-v","errorCode":null,"errorMessage":"while executing Process for %v","messagePattern":"while executing Process for (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/plan.go","lineNumber":156,"sourceCode":"\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}\n\tp.setStatus(Up)\n\treturn nil\n}\n\n// Finalize runs any callbacks registered by the bundleFinalizer. Should be run on bundle finalization.\nfunc (p *Plan) Finalize() error {\n\tif s := p.getStatus(); s != Up {\n\t\treturn errors.Errorf(\"invalid status for plan %v: %v\", p.id, s)\n\t}\n\tfailedIndices := []int{}","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/plan.go#L138-L174","documentation":"During Plan.Execute, each root unit's Process() step is run; if it (or user DoFn code beneath it) returns an error or panics, the plan is marked Broken and the error is wrapped with the plan identity. This indicates bundle processing failed mid-flight, so the plan can no longer be trusted and must be torn down or restarted.","triggerScenarios":"Any root unit returns an error from Process() during bundle execution — e.g. a DoFn's ProcessElement returns an error, an inner exec unit fails, or a panic is converted by callNoPanic.","commonSituations":"User DoFn code fails on a specific record (nil field, bad cast, network call inside the DoFn), a side input fails to load, or a sink write fails during a streaming bundle on Dataflow/Flink runners.","solutions":["Look at the wrapped (inner) error for the actual failing unit/DoFn and fix that root cause","Make the DoFn idempotent/robust: validate input records and return descriptive errors or use a dead-letter output instead of failing","Retry the whole bundle: the plan is Broken, so build/re-execute a fresh Plan rather than reusing this one","Check whether the failing record is poison; guard with nil checks or schema validation in the DoFn"],"exampleFix":"// before: DoFn crashes on nil\nfunc (f *myFn) ProcessElement(ctx context.Context, elm Customer, emit func(string)) error {\n    return doWork(elm.PrimaryID) // panics if elm is zero-valued\n}\n// after\nfunc (f *myFn) ProcessElement(ctx context.Context, elm Customer, emit func(string)) error {\n    if elm.PrimaryID == \"\" {\n        return nil // or emit to a dead-letter PCollection\n    }\n    return doWork(elm.PrimaryID)\n}","handlingStrategy":"try-catch","validationCode":"// In the DoFn, validate before doing work\nfunc (f *myFn) ProcessElement(elm Customer, emit func(string)) error {\n    if elm.PrimaryID == \"\" { return nil }\n    return nil\n}","typeGuard":"func isValidCustomer(c Customer) bool { return c.PrimaryID != \"\" }","tryCatchPattern":"if err := plan.Execute(ctx); err != nil {\n    var wrapped interface{ Unwrap() error }\n    log.Printf(\"plan broken: %v; cause: %v\", err, errors.Unwrap(err))\n    plan.Down() // must tear down; plan cannot be reused\n    return fmt.Errorf(\"bundle failed: %w\", err)\n}","preventionTips":["Make DoFn ProcessElement defensive against nil/zero-valued records","Use dead-letter outputs instead of returning errors for bad records","Test DoFns with edge-case inputs before deploying","Log the unwrapped inner error to find the real failing unit"],"tags":["go","apache-beam","execution-plan","bundle-processing"],"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"}