apache/beam · critical

attempted to add namespace to missing windowing strategy id:

Error message

attempted to add namespace to missing windowing strategy id: %v not in %v

What it means

addWindowingStrategyID rewrites a windowing strategy's references under a new namespace during cross-language expansion. This panic fires when the windowing strategy ID referenced in the pipeline's Components is missing from Components.WindowingStrategies — a dangling reference in the pipeline proto. Like its coder counterpart it is an internal invariant panic.

Source

Thrown at sdks/go/pkg/beam/core/runtime/xlangx/namespace.go:62

	}

	idMap[cid] = newID(cid)

	// Updating Coders map
	c.Coders[idMap[cid]] = coder
	delete(c.Coders, cid)

	return idMap[cid]
}

func addWindowingStrategyID(c *pipepb.Components, idMap map[string]string, wid string, newID func(string) string) string {
	if _, exists := idMap[wid]; exists {
		return idMap[wid]
	}

	windowingStrategy, exists := c.WindowingStrategies[wid]
	if !exists {
		panic(errors.Errorf("attempted to add namespace to missing windowing strategy id: %v not in %v", wid, c.WindowingStrategies))
	}

	// Updating WindowCoderID of WindowingStrategy
	if windowingStrategy.WindowCoderId != "" {
		windowingStrategy.WindowCoderId = addCoderID(c, idMap, windowingStrategy.WindowCoderId, newID)
	}

	idMap[wid] = newID(wid)

	// Updating WindowingStrategies map
	c.WindowingStrategies[idMap[wid]] = windowingStrategy
	delete(c.WindowingStrategies, wid)

	return idMap[wid]
}

func addNamespace(t *pipepb.PTransform, c *pipepb.Components, namespace string) {
	newID := func(id string) string {

View on GitHub (pinned to 12126d8942)

Solutions

  1. Verify every WindowingStrategyId referenced by coders/transforms exists in Components.WindowingStrategies before calling Expand.
  2. Use the official Beam pipeline-construction APIs so windowing strategies are registered automatically.
  3. Align Beam SDK versions across language SDKs and re-run the expansion job.
  4. Report a runner/SDK bug if a standard pipeline (built via beam.Pipeline) hits this panic.

Example fix

// before: pipeline proto hand-copied without windowing strategies
pipe.Components.WindowingStrategies = map[string]*pipepb.WindowingStrategy{}

// after: keep the full component set from the deserialized pipeline
pipe, _ := pipelinepb.FromJSON(pipelineJSON) // includes windowing strategies
Defensive patterns

Strategy: validation

Validate before calling

for _, c := range pipe.Components.Coders {
    if wid := c.GetWindowCoderId(); wid != "" {
        if _, ok := pipe.Components.WindowingStrategies[wid]; !ok {
            return fmt.Errorf("dangling windowing strategy id %q", wid)
        }
    }
}

Prevention

When it happens

Trigger: xlangx.Expand / addNamespace processing a pipeline whose transform or coder references a WindowingStrategyId never registered in Components.WindowingStrategies; manually mutated pipeline protos; expansion responses missing windowing strategy entries.

Common situations: Cross-language expansion with windowed P collections across SDK boundaries; custom runner code that reconstructs pipeline components; Beam version skew where IDs are not carried across expansion correctly.

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/42a3ca0aa266ac27. Report an issue: GitHub.