{"record":{"id":"d7364873f65bda8e","repo":"apache/beam","slug":"plan-v-failed-with-multiple-errors-v","errorCode":null,"errorMessage":"plan %v failed with multiple errors: %v","messagePattern":"plan (.+?) failed with multiple errors: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/plan.go","lineNumber":230,"sourceCode":"\tif p.getStatus() == Down {\n\t\treturn nil // ok: already down\n\t}\n\tp.setStatus(Down)\n\n\tvar errs []error\n\tfor _, u := range p.units {\n\t\tif err := callNoPanic(ctx, u.Down); err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\n\tswitch len(errs) {\n\tcase 0:\n\t\treturn nil\n\tcase 1:\n\t\treturn errors.Wrapf(errs[0], \"plan %v failed\", p.id)\n\tdefault:\n\t\treturn errors.Errorf(\"plan %v failed with multiple errors: %v\", p.id, errs)\n\t}\n}\n\nfunc (p *Plan) String() string {\n\tvar units []string\n\tfor i := len(p.units) - 1; i >= 0; i-- {\n\t\tu := p.units[i]\n\t\tunits = append(units, fmt.Sprintf(\"%v: %v\", u.ID(), u))\n\t}\n\treturn fmt.Sprintf(\"Plan[%v]:\\n%v\", p.ID(), strings.Join(units, \"\\n\"))\n}\n\n// PlanSnapshot contains system metrics for the current run of the plan.\ntype PlanSnapshot struct {\n\tSource ProgressReportSnapshot\n\tPCols  []PCollectionSnapshot\n}\n","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/plan.go#L212-L248","documentation":"Plan.Down() tears down all units and aggregates every unit's Down() error. When more than one unit fails teardown, it returns this error listing all of them, signaling widespread cleanup failure in the plan.","triggerScenarios":"Calling Plan.Down() when two or more units return non-nil errors from Down() — e.g. both a datasource and a sink failing cleanup, or multiple sinks failing to close.","commonSituations":"Worker shutdown under broken conditions (e.g. after network loss, multiple sinks fail to flush), failed deployments where credentials or mounts were revoked before teardown, or a process-wide resource failure hitting several units at once.","solutions":["Examine the list of aggregated errors to identify every failing unit","Fix each underlying teardown failure (connectivity, permissions, double-close)","Make unit Down() implementations idempotent and best-effort so teardown errors don't multiply","Check for a shared root cause (lost network, revoked mount) rather than fixing units individually"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// Same as single-error case: idempotent, nil-tolerant Down in every unit","typeGuard":null,"tryCatchPattern":"if err := plan.Down(); err != nil {\n    for _, e := range multierr.Errors(err) { // aggregated errors\n        log.Printf(\"unit teardown failed: %v\", e)\n    }\n}","preventionTips":["Check for shared root causes (network loss, revoked credentials) when multiple units fail at once","Keep Down() implementations best-effort: collect errors, never abort remaining cleanup","Monitor worker logs for recurring teardown failures across bundles","Release shared resources (mounts, pools) at the process level as a safety net"],"tags":["go","apache-beam","execution-plan","teardown"],"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"}