apache/beam · error

could not unmarshal window coder for pcollection %v: %w

Error message

could not unmarshal window coder for pcollection %v: %w

What it means

A follow-on failure in makeCoderForPCollection: the windowing strategy was found, but decoding its window coder via b.coders.WindowCoder(ws.GetWindowCoderId()) failed. The error wraps the underlying cause (unknown coder id, unsupported coder URN, etc.) with pcollection context.

Source

Thrown at sdks/go/pkg/beam/core/runtime/exec/translate.go:370

	c, err := b.coders.Coder(col.CoderId)
	if err != nil {
		return nil, nil, err
	}
	if coder.IsW(c) {
		// TODO(herohde) 3/16/2018: remove potential WindowedValue from Dataflow.
		// However, windowing strategies are not yet passed through, so the main
		// path always gives us GlobalWindows.

		return coder.SkipW(c), c.Window, nil
	}

	ws, ok := b.desc.GetWindowingStrategies()[col.GetWindowingStrategyId()]
	if !ok {
		return nil, nil, errors.Errorf("windowing strategy %v not found", id)
	}
	wc, err := b.coders.WindowCoder(ws.GetWindowCoderId())
	if err != nil {
		return nil, nil, errors.Errorf("could not unmarshal window coder for pcollection %v: %w", id, err)
	}
	return c, wc, nil
}

func (b *builder) makePCollection(id string) (*PCollection, error) {
	if n, exists := b.nodes[id]; exists {
		return n, nil
	}

	list := b.succ[id]

	var u Node
	switch len(list) {
	case 0:
		// Discard.

		u = &Discard{UID: b.idgen.New()}

View on GitHub (pinned to 12126d8942)

Solutions

  1. Check the wrapped error to identify the missing/invalid window coder id and ensure it's registered in the component coder map
  2. Ensure runners register all coders referenced by windowing strategies
  3. Align SDK/runner versions and regenerate the pipeline
Defensive patterns

Strategy: fallback

Validate before calling

// Pre-check window coder registry completeness
for _, ws := range desc.GetWindowingStrategies() {
    if _, err := coders.WindowCoder(ws.GetWindowCoderId()); err != nil {
        return fmt.Errorf("window coder %s missing: %w", ws.GetWindowCoderId(), err)
    }
}

Try / catch

if err := exec.UnmarshalPlan(desc); err != nil {
    var target *errors.Error
    if strings.Contains(err.Error(), "could not unmarshal window coder") {
        log.Printf("window coder decode failed: %v", err) // inspect wrapped cause
    }
}

Prevention

When it happens

Trigger: WindowingStrategy references a WindowCoderId that is absent from the coder registry or cannot be decoded, while building the plan for a pcollection.

Common situations: Runner not registering the window coder id in the coders map; unsupported/custom window coders; protocol mismatch between runner and Go SDK coder registries.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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