apache/beam · error
failed to add window strategy
Error message
failed to add window strategy %v
What it means
addWindowingStrategy marshals a window.WindowingStrategy into a pipepb.WindowingStrategy via MarshalWindowingStrategy. Any marshal failure (unsupported window kind, coder failure for the window, bad trigger) is wrapped as 'failed to add window strategy %v' before the default environment is attached and the strategy is interned.
Solutions
- Inspect the wrapped error from MarshalWindowingStrategy for the specific unsupported component
- Restrict pipelines to supported window kinds and standard triggers
- If a custom WindowFn is required, translate it into one of the supported kinds before submitting
- Upgrade/align the Go SDK version with the rest of the pipeline's SDKs
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
// pre-check windowing strategy components before building pipeline
ws := n.WindowingStrategy()
if ws == nil || ws.Fn() == nil {
return errors.New("missing windowing strategy")
} Try / catch
if err := beam.Run(ctx, pr); err != nil {
if strings.Contains(err.Error(), "failed to add window strategy") {
return fmt.Errorf("windowing strategy not supported by Go marshaller: %w", err)
}
return err
} Prevention
- Use only built-in window kinds and default triggers
- Cross-check windowing features against the SDK version's supported set
- Keep strategy construction inside beam APIs, not hand-built structs
When it happens
Trigger: A node with an unsupported windowing strategy reaches makeNode: non-standard window.Kind, a window coder that fails to construct, or trigger payloads that cannot be marshalled.
Common situations: Custom WindowFn implementations; windowing strategies carried across language boundaries that the Go marshaller cannot express; SDK version drift introducing unmarshalable window settings.
Related errors
- failed to add input kind
- failed to make node with node id
- AfterProcessingTime trigger set without a delay or…
- array len mismatch. decoding
- At least one subtrigger required for composite triggers.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/1c61b82309d1f89d.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/runtime/graphx/translate.go:1225
if _, exists := m.environments[defaultEnvId]; !exists {
env := proto.Clone(m.opt.Environment).(*pipepb.Environment)
// If there's no environment set, we need to ignore
if env == nil {
return defaultEnvId
}
// Add the pipeline level resource hints here for now.
// TODO(https://github.com/apache/beam/issues/23893) move to a better place for
// scoped hints in next pass, which affect number of environments set by Go pipelines.
env.ResourceHints = m.opt.PipelineResourceHints.Payloads()
m.environments[defaultEnvId] = env
}
return defaultEnvId
}
func (m *marshaller) addWindowingStrategy(w *window.WindowingStrategy) (string, error) {
ws, err := MarshalWindowingStrategy(m.coders, w)
if err != nil {
return "", errors.Wrapf(err, "failed to add window strategy %v", w)
}
ws.EnvironmentId = m.addDefaultEnv()
return m.internWindowingStrategy(ws), nil
}
func (m *marshaller) internWindowingStrategy(w *pipepb.WindowingStrategy) string {
key := w.String()
if id, exists := m.windowing2id[(key)]; exists {
return id
}
id := fmt.Sprintf("w%v", len(m.windowing2id))
m.windowing2id[string(key)] = id
m.windowing[id] = w
return id
}
// MarshalWindowingStrategy marshals the given windowing strategy inView on GitHub (pinned to 12126d8942)