apache/beam · critical

WindowedValue coder with more than 2 components: %s

Error message

WindowedValue coder with more than 2 components: %s

What it means

A WindowedValue coder must have exactly two components (the value coder and the window coder). pullDecoderNoAlloc panics when the component list has a different length, indicating a malformed coder graph from the SDK.

Source

Thrown at sdks/go/pkg/beam/runners/prism/internal/coders.go:362

			for i := int32(0); i < l; i++ {
				ed(r)
			}
		}
	case urns.CoderKV:
		ccids := c.GetComponentCoderIds()
		if len(ccids) != 2 {
			panic(fmt.Sprintf("KV coder with more than 2 components: %s", prototext.Format(c)))
		}
		kd := pullDecoderNoAlloc(coders[ccids[0]], coders)
		vd := pullDecoderNoAlloc(coders[ccids[1]], coders)
		return func(r io.Reader) {
			kd(r)
			vd(r)
		}
	case urns.CoderWindowedValue:
		ccids := c.GetComponentCoderIds()
		if len(ccids) != 2 {
			panic(fmt.Sprintf("WindowedValue coder with more than 2 components: %s", prototext.Format(c)))
		}
		ed := pullDecoderNoAlloc(coders[ccids[0]], coders)
		wd := pullDecoderNoAlloc(coders[ccids[1]], coders)
		return func(r io.Reader) {
			ed(r)
			wd(r)
		}
	case urns.CoderShardedKey:
		ccids := c.GetComponentCoderIds()
		if len(ccids) != 1 {
			panic(fmt.Sprintf("ShardedKey coder must have only 1 component: %s", prototext.Format(c)))
		}
		kd := pullDecoderNoAlloc(coders[ccids[0]], coders)
		return func(r io.Reader) {
			l, _ := coder.DecodeVarInt(r)
			ioutilx.ReadN(r, int(l))
			kd(r)
		}

View on GitHub (pinned to 12126d8942)

Solutions

  1. Examine the printed coder proto and confirm component_coder_ids has exactly 2 entries
  2. Ensure the SDK side uses standard windowed-value coder construction (beam.WindowInto paths)
  3. Align SDK and runner versions to the same Beam release
  4. Minimize the pipeline to find the transform emitting the malformed coder

Example fix

// before
wc := pipepb.Coder_Urn_WINDOWED_VALUE // components built ad hoc
// after
wvCoder := beam.CreateWindowedValueCoder(valueCoder, intervalWindowCoder) // exactly 2 components
Defensive patterns

Strategy: validation

Validate before calling

if len(wvCoder.GetComponentCoderIds()) != 2 { return fmt.Errorf("WindowedValue coder must have exactly 2 components, got %d", len(wvCoder.GetComponentCoderIds())) }

Try / catch

defer func() { if r := recover(); r != nil { log.Errorf("windowed-value coder panicked: %v", r) } }()

Prevention

When it happens

Trigger: pullDecoderNoAlloc sees urn beam:coders:windowed_value:v1 with GetComponentCoderIds() length != 2, e.g. the window component coder ID missing or duplicated, usually from a harness/SDK coder mismatch.

Common situations: Custom windowing code in an SDK emitting a windowed-value coder with wrong components; version skew between SDK and prism; cross-language pipelines where window coders aren't propagated 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/0d5abd6ff87c82d5. Report an issue: GitHub.