{"record":{"id":"5a8ef867af0ebf27","repo":"apache/beam","slug":"pipeline-panicked-v-stacktrace-s","errorCode":null,"errorMessage":"pipeline panicked: %v\nStacktrace: %s","messagePattern":"pipeline panicked: (.+?)\nStacktrace: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"sdks/go/pkg/beam/runners/prism/internal/execute.go","lineNumber":83,"sourceCode":"\t\t\t\treturn\n\t\t\t}\n\t\t\terr := fmt.Errorf(\"prism %v didn't get control connection to %v after %v\", wk, wk.Endpoint(), timeout)\n\t\t\tj.Failed(err)\n\t\t\tj.CancelFn(err)\n\t\t})\n\t}\n\n\t// When this function exits, we cancel the context to clear\n\t// any related job resources.\n\tdefer func() {\n\t\tj.CancelFn(fmt.Errorf(\"runPipeline returned, cleaning up\"))\n\t\tj.WaitForCleanUp()\n\t}()\n\n\t// Add this defer function to capture and log panics.\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tj.Failed(fmt.Errorf(\"pipeline panicked: %v\\nStacktrace: %s\", e, string(debug.Stack())))\n\t\t}\n\t}()\n\n\tj.SendMsg(\"running \" + j.String())\n\tj.Running()\n\n\tif err := executePipeline(j.RootCtx, wks, j); err != nil && !errors.Is(err, jobservices.ErrCancel) {\n\t\tj.Failed(err)\n\t\treturn\n\t}\n\n\tif errors.Is(context.Cause(j.RootCtx), jobservices.ErrCancel) {\n\t\tj.SendMsg(\"pipeline canceled \" + j.String())\n\t\tj.Canceled()\n\t\treturn\n\t}\n\n\tj.SendMsg(\"pipeline completed \" + j.String())","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/prism/internal/execute.go#L65-L101","documentation":"RunPipeline installs a deferred recover() so any panic in prism's pipeline execution path is captured, the stack trace logged into the error, and the job marked Failed instead of crashing the prism process. This is a runner-side panic boundary, not a user-code error.","triggerScenarios":"Any unrecovered Go panic during executePipeline/RunPipeline internals — nil dereference, index out of range, or assertion failure in stage building or event handling.","commonSituations":"Pipelines with shapes that hit prism bugs (TestStream, unusual windowing, cross-language transforms); typically a Beam runner defect.","solutions":["Extract the stacktrace from the error message and locate the panic site in prism","Minimize the pipeline reproducing the panic and file a Beam Jira issue","Upgrade Beam/prism to the latest release where the panic may be fixed","As a workaround, restructure the offending transform or pipeline stage"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := j.WaitUntilDone(ctx); err != nil {\n  if strings.Contains(err.Error(), \"pipeline panicked\") {\n    stack := extractAfter(err, \"Stacktrace:\")\n    reportToBeamIssue(stack)\n  }\n}","preventionTips":["Exercise pipelines with TestStream/windowing in CI on small inputs","Keep prism/Beam updated for runner bug fixes"],"tags":["go","beam","prism-runner","panic","recovery"],"backgroundTag":"internal-invariant-violation","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"}