apache/beam · error
unable to marshal windowing strategy for PCol
Error message
unable to marshal windowing strategy for PCol %v: %w
What it means
PCol.WindowingStrategy marshals a PCollection's windowing strategy to a proto for cross-language pipeline serialization. If graphx.MarshalWindowingStrategy fails, this panic fires with the PCollection's local name and the underlying error. It indicates an internal marshaling failure, typically from an unsupported or corrupt windowing strategy, not user input validation.
Solutions
- Use standard windowing (fixed, sliding, session, global) supported by Beam's proto schema.
- Check the wrapped error (%v of err) for the exact marshal failure cause.
- If a custom window fn is required, implement proto-serialization support or file an issue upstream.
- Verify all SDKs in the cross-language pipeline are compatible versions.
Example fix
// before w := beam.WindowInto(s, window.NewCustomWindowFn(...), col) // custom fn unmarshalable // after w := beam.WindowInto(s, window.NewFixedWindows(60*time.Second), col)
Defensive patterns
Strategy: try-catch
Try / catch
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("windowing strategy marshaling failed: %v", r)
}
}() Prevention
- Stick to built-in Beam windowing functions for cross-language pipelines
- Upgrade/match SDK versions across language SDKs
- Read the wrapped cause in the panic message before changing pipeline code
When it happens
Trigger: Building a cross-language pipeline whose PCollection has a windowing strategy graphx cannot marshal (unknown/unsupported window fn or cusum arguments failing proto encoding), reached via the expansion/translation path.
Common situations: Custom windowing functions not supported by the proto schema; pipelines crossing Go SDK boundaries with exotic windowing configurations; version skew between SDK components introducing unmarshalable strategies.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- AfterProcessingTime trigger set without a delay or…
- attempted to add namespace to missing windowing strategy id
- error decoding append bag user state window key
- error encoding pane : non-speculative index value must be…
- Init hooks have already run. Register function during…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/875ec235a84e2d8a.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/runtime/xlangx/registry.go:112
}
// ID produces a standard format globally namespaced id for a PCollection from the local identifier.
func (p *PCol) ID() string {
return fmt.Sprintf("n%v@%v", p.Local, p.namespace)
}
// WSID produces a standard format globally namespaced id for a WindowingStrategy from the local identifier.
func (p *PCol) WSID() string {
return fmt.Sprintf("ws%v@%v", p.Local, p.namespace)
}
// WindowingStrategy returns the id to this PCollection's windowing strategy, and the associated proto.
//
// TODO: intern windowing strategies.
func (p *PCol) WindowingStrategy(cm *graphx.CoderMarshaller) (string, *pipepb.WindowingStrategy) {
wspb, err := graphx.MarshalWindowingStrategy(cm, p.node.WindowingStrategy())
if err != nil {
panic(fmt.Errorf("unable to marshal windowing strategy for PCol %v: %w", p.Local, err))
}
return p.WSID(), wspb
}
func makePCol(node *graph.Node, index int, local, namespace string) PCol {
return PCol{
Index: index,
Local: local,
Coder: node.Coder,
Bounded: pipelinex.BoolToBounded(node.Bounded()),
namespace: namespace,
node: node,
}
}
// Outputs returns the provided output PCollections, if any, for expected outputs
// for this expansion service request.View on GitHub (pinned to 12126d8942)