apache/beam · error

bad window

Error message

bad window: %v

What it means

decodeWindowCoder maps a wire CoderRef back to a WindowCoder. The ref's Type must be one of the two known window type markers (globalWindowType or intervalWindowType); anything else is rejected because the window representation is unknown to graphx.

Solutions

  1. Use the same Beam Go SDK version to serialize and deserialize the pipeline.
  2. Re-serialize the pipeline with a supported windowing strategy (global or interval).
  3. Inspect the CoderRef.Type in the pipeline spec to identify which window type string is unexpected and map it to a supported one.

Example fix

// before: window type from newer SDK
CoderRef{Type: &protobuf.Type{...}}
// after: pin SDK versions
// go.mod: require github.com/apache/beam/sdks/v2 vX.Y.Z  (same as job submitter)
Defensive patterns

Strategy: validation

Validate before calling

if w.Type == nil || (w.Type.String() != globalWindowType.String() && w.Type.String() != intervalWindowType.String()) {
    return errors.New("unknown window coder type")
}

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "bad window:") {
        // check SDK version parity before re-decoding
    }
}

Prevention

When it happens

Trigger: DecodeCoderRef encounters a windowed coder ref whose Type URL does not match globalWindowType or intervalWindowType — typically a ref produced by a different Beam version or a foreign runner.

Common situations: Deserializing pipelines saved by a newer/older Beam release; cross-version job submission (e.g. runner built with different SDK); corrupted or externally rewritten pipeline JSON.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at sdks/go/pkg/beam/core/runtime/graphx/dataflow.go:408

	case coder.GlobalWindow:
		return &CoderRef{Type: globalWindowType}, nil
	case coder.IntervalWindow:
		return &CoderRef{Type: intervalWindowType}, nil
	default:
		return nil, errors.Errorf("bad window kind: %v", w.Kind)
	}
}

// decodeWindowCoder receives the wire representation of a Beam coder, extracting
// the preprocessed representation, expanding all types used by the coder.
func decodeWindowCoder(w *CoderRef) (*coder.WindowCoder, error) {
	switch w.Type {
	case globalWindowType:
		return coder.NewGlobalWindow(), nil
	case intervalWindowType:
		return coder.NewIntervalWindow(), nil
	default:
		return nil, errors.Errorf("bad window: %v", w.Type)
	}
}

View on GitHub (pinned to 12126d8942)