apache/beam · critical

pipeline panicked: %v Stacktrace: %s

Error message

pipeline panicked: %v
Stacktrace: %s

What it means

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.

Source

Thrown at sdks/go/pkg/beam/runners/prism/internal/execute.go:83

				return
			}
			err := fmt.Errorf("prism %v didn't get control connection to %v after %v", wk, wk.Endpoint(), timeout)
			j.Failed(err)
			j.CancelFn(err)
		})
	}

	// When this function exits, we cancel the context to clear
	// any related job resources.
	defer func() {
		j.CancelFn(fmt.Errorf("runPipeline returned, cleaning up"))
		j.WaitForCleanUp()
	}()

	// Add this defer function to capture and log panics.
	defer func() {
		if e := recover(); e != nil {
			j.Failed(fmt.Errorf("pipeline panicked: %v\nStacktrace: %s", e, string(debug.Stack())))
		}
	}()

	j.SendMsg("running " + j.String())
	j.Running()

	if err := executePipeline(j.RootCtx, wks, j); err != nil && !errors.Is(err, jobservices.ErrCancel) {
		j.Failed(err)
		return
	}

	if errors.Is(context.Cause(j.RootCtx), jobservices.ErrCancel) {
		j.SendMsg("pipeline canceled " + j.String())
		j.Canceled()
		return
	}

	j.SendMsg("pipeline completed " + j.String())

View on GitHub (pinned to 12126d8942)

Solutions

  1. Extract the stacktrace from the error message and locate the panic site in prism
  2. Minimize the pipeline reproducing the panic and file a Beam Jira issue
  3. Upgrade Beam/prism to the latest release where the panic may be fixed
  4. As a workaround, restructure the offending transform or pipeline stage
Defensive patterns

Strategy: try-catch

Try / catch

if err := j.WaitUntilDone(ctx); err != nil {
  if strings.Contains(err.Error(), "pipeline panicked") {
    stack := extractAfter(err, "Stacktrace:")
    reportToBeamIssue(stack)
  }
}

Prevention

When it happens

Trigger: Any unrecovered Go panic during executePipeline/RunPipeline internals — nil dereference, index out of range, or assertion failure in stage building or event handling.

Common situations: Pipelines with shapes that hit prism bugs (TestStream, unusual windowing, cross-language transforms); typically a Beam runner defect.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/5a8ef867af0ebf27. Report an issue: GitHub.