apache/beam · error

error computing pipeline facts

Error message

error computing pipeline facts: %w

What it means

In preProcessGraph, Prism runs computeFacts over the topologically sorted transforms to derive pipeline facts (producers, side inputs, etc.). If that computation fails, the error is wrapped with this prefix, sent to the job's message stream, and the job is marked Failed.

Solutions

  1. Inspect the wrapped cause message to see which pipeline invariant computeFacts violated.
  2. Simplify or re-expand composites in the pipeline so each PCollection has exactly one producer.
  3. Validate the pipeline graph with the DirectRunner, which tolerates graphs Prism rejects, to isolate the construct.
  4. Report the pipeline graph to the Beam project if a valid pipeline triggers this.
Defensive patterns

Strategy: try-catch

Validate before calling

// client-side: run the pipeline through DirectRunner first to surface graph problems
if err := directRun(pipeline); err != nil {
    return fmt.Errorf("pipeline graph invalid, prism will reject it: %w", err)
}

Try / catch

err := submitToPrism(pipeline)
if err != nil && strings.Contains(err.Error(), "error computing pipeline facts") {
    log.Printf("prism rejected graph: %v", err) // fix graph then resubmit
}

Prevention

When it happens

Trigger: executePipeline invokes preProcessGraph and computeFacts returns an error — such as a PCollection with two producers, or a transform whose side inputs can't be interpreted — before any stage fusion happens.

Common situations: Pipelines with malformed or unusual transform graphs (composite expansion leftovers, duplicate output wiring); SDK-emitted pipelines that violate Prism's single-producer assumptions.

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/9ae28f2b03500ca6. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/runners/prism/internal/preprocess.go:163

		// It's unlikely for these to change, but better to handle them now, to save a headache later.
		for wid, w := range prepResult.SubbedComps.GetWindowingStrategies() {
			comps.GetWindowingStrategies()[wid] = w
		}
		for envid, env := range prepResult.SubbedComps.GetEnvironments() {
			comps.GetEnvironments()[envid] = env
		}
	}

	// Extract URNs for the given transform.

	keptLeaves := maps.Keys(leaves)
	sort.Strings(keptLeaves)
	topological := pipelinex.TopologicalSort(ts, keptLeaves)
	slog.Debug("topological transform ordering", slog.Any("topological", topological))

	facts, err := computeFacts(topological, comps)
	if err != nil {
		err = fmt.Errorf("error computing pipeline facts: %w", err)
		j.SendMsg(err.Error())
		j.Failed(err)
		return nil
	}
	facts.ForcedRoots = forcedRoots

	// avoid "unused" warnings while keeping the older default approach available.
	_ = greedyFusion
	_ = defaultFusion

	stages := greedyFusion(topological, comps, facts)

	for i, stg := range stages {
		err := finalizeStage(stg, comps, facts)
		if err != nil {
			err = fmt.Errorf("preprocess validation failure of stage %v: %v", i, err)
			j.SendMsg(err.Error())
			j.Failed(err)

View on GitHub (pinned to 12126d8942)