{"record":{"id":"f6940dde1bfd7a68","repo":"apache/beam","slug":"window-coder-with-unexpected-type-v","errorCode":null,"errorMessage":"window coder with unexpected type %v","messagePattern":"window coder with unexpected type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/coder.go","lineNumber":608,"sourceCode":"\tfor _, c := range list {\n\t\tif id, err := b.Add(c); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to marshal the coder %v.\", c)\n\t\t} else {\n\t\t\tids = append(ids, id)\n\t\t}\n\t}\n\treturn ids, nil\n}\n\n// AddWindowCoder adds a window coder.\nfunc (b *CoderMarshaller) AddWindowCoder(w *coder.WindowCoder) (string, error) {\n\tswitch w.Kind {\n\tcase coder.GlobalWindow:\n\t\treturn b.internBuiltInCoder(urnGlobalWindow), nil\n\tcase coder.IntervalWindow:\n\t\treturn b.internBuiltInCoder(urnIntervalWindow), nil\n\tdefault:\n\t\terr := errors.Errorf(\"window coder with unexpected type %v\", w.Kind)\n\t\treturn \"\", errors.WithContextf(err, \"failed to unmarshal window coder %v\", w)\n\t}\n}\n\n// Build returns the set of model coders. Note that the map may be larger\n// than the number of coders added, because component coders are included.\nfunc (b *CoderMarshaller) Build() map[string]*pipepb.Coder {\n\treturn b.coders\n}\n\nfunc (b *CoderMarshaller) internBuiltInCoder(urn string, components ...string) string {\n\treturn b.internCoder(&pipepb.Coder{\n\t\tSpec: &pipepb.FunctionSpec{\n\t\t\tUrn: urn,\n\t\t},\n\t\tComponentCoderIds: components,\n\t})\n}","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/coder.go#L590-L626","documentation":"Produced by CoderMarshaller.AddWindowCoder when the window coder's Kind is neither GlobalWindow nor IntervalWindow. The marshaller only knows how to emit model URNs for those two window kinds, so any other kind fails with this error and is wrapped with 'failed to unmarshal window coder'.","triggerScenarios":"AddWindowCoder(w) (called from Add for windowed coders, expandReshuffle, or MarshalWindowingStrategy) with a coder whose w.Kind is an unimplemented window type.","commonSituations":"Custom WindowFn implementations producing custom window kinds; experiments or SDKs with new window kinds not yet mapped in Go; misuse of coder constructors producing an invalid window kind.","solutions":["Log w.Kind to see which window type was rejected.","Use beam.GlobalWindows or beam.FixedWindows/SlidingWindows (IntervalWindow) windowing.","Remove custom window kinds from the pipeline or implement serialization support in AddWindowCoder.","Verify the windowing strategy assigned to the PCollection is a built-in Beam window function.","Upgrade Beam if the window kind is newly supported upstream."],"exampleFix":"// before\nw := coder.WindowCoder{Kind: myCustomWindowKind}\n// after\nw := coder.NewIntervalWindowCoder() // or coder.NewGlobalWindowCoder()","handlingStrategy":"type-guard","validationCode":"if w.Kind != coder.GlobalWindow && w.Kind != coder.IntervalWindow {\n    return errors.New(\"window kind must be GlobalWindow or IntervalWindow\")\n}","typeGuard":"func isSupportedWindowKind(w *coder.WindowCoder) bool {\n    return w != nil && (w.Kind == coder.GlobalWindow || w.Kind == coder.IntervalWindow)\n}","tryCatchPattern":"id, err := b.AddWindowCoder(w)\nif err != nil {\n    return \"\", fmt.Errorf(\"window coder %v unsupported (kind=%v): %w\", w, w.Kind, err)\n}","preventionTips":["Restrict pipelines to GlobalWindows or interval-based windows.","Do not invent custom window kinds in the Go SDK.","Cross-check windowing strategy support in cross-language pipelines."],"tags":["go","apache-beam","windowing","serialization"],"backgroundTag":"unsupported-enum-value","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"}