{"record":{"id":"1c61b82309d1f89d","repo":"apache/beam","slug":"failed-to-add-window-strategy-v","errorCode":null,"errorMessage":"failed to add window strategy %v","messagePattern":"failed to add window strategy (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/translate.go","lineNumber":1225,"sourceCode":"\tif _, exists := m.environments[defaultEnvId]; !exists {\n\t\tenv := proto.Clone(m.opt.Environment).(*pipepb.Environment)\n\t\t// If there's no environment set, we need to ignore\n\t\tif env == nil {\n\t\t\treturn defaultEnvId\n\t\t}\n\t\t// Add the pipeline level resource hints here for now.\n\t\t// TODO(https://github.com/apache/beam/issues/23893) move to a better place for\n\t\t// scoped hints in next pass, which affect number of environments set by Go pipelines.\n\t\tenv.ResourceHints = m.opt.PipelineResourceHints.Payloads()\n\t\tm.environments[defaultEnvId] = env\n\t}\n\treturn defaultEnvId\n}\n\nfunc (m *marshaller) addWindowingStrategy(w *window.WindowingStrategy) (string, error) {\n\tws, err := MarshalWindowingStrategy(m.coders, w)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"failed to add window strategy %v\", w)\n\t}\n\tws.EnvironmentId = m.addDefaultEnv()\n\treturn m.internWindowingStrategy(ws), nil\n}\n\nfunc (m *marshaller) internWindowingStrategy(w *pipepb.WindowingStrategy) string {\n\tkey := w.String()\n\tif id, exists := m.windowing2id[(key)]; exists {\n\t\treturn id\n\t}\n\n\tid := fmt.Sprintf(\"w%v\", len(m.windowing2id))\n\tm.windowing2id[string(key)] = id\n\tm.windowing[id] = w\n\treturn id\n}\n\n// MarshalWindowingStrategy marshals the given windowing strategy in","sourceCodeStart":1207,"sourceCodeEnd":1243,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/translate.go#L1207-L1243","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom WindowFn implementations; windowing strategies carried across language boundaries that the Go marshaller cannot express; SDK version drift introducing unmarshalable window settings.","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"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"// pre-check windowing strategy components before building pipeline\nws := n.WindowingStrategy()\nif ws == nil || ws.Fn() == nil {\n    return errors.New(\"missing windowing strategy\")\n}","typeGuard":null,"tryCatchPattern":"if err := beam.Run(ctx, pr); err != nil {\n    if strings.Contains(err.Error(), \"failed to add window strategy\") {\n        return fmt.Errorf(\"windowing strategy not supported by Go marshaller: %w\", err)\n    }\n    return err\n}","preventionTips":["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"],"tags":["go","apache-beam","windowing-strategy","marshalling"],"backgroundTag":"unsupported-windowing-strategy","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}