{"record":{"id":"c257abf9148a02ee","repo":"apache/beam","slug":"unexpected-coder-kind-v","errorCode":null,"errorMessage":"unexpected coder kind: %v","messagePattern":"unexpected coder kind: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/coder.go","lineNumber":582,"sourceCode":"\t\tcomp = append(comp, ids...)\n\n\t\tid, err := b.AddWindowCoder(c.Window)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to marshal window coder %v\", c)\n\t\t}\n\t\tcomp = append(comp, id)\n\n\t\treturn b.internBuiltInCoder(urnTimerCoder, comp...), nil\n\n\tcase coder.Iterable:\n\t\tcomp, err := b.AddMulti(c.Components)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to marshal iterable coder %v\", c)\n\t\t}\n\t\treturn b.internBuiltInCoder(urnIterableCoder, comp...), nil\n\n\tdefault:\n\t\terr := errors.Errorf(\"unexpected coder kind: %v\", c.Kind)\n\t\treturn \"\", errors.WithContextf(err, \"failed to marshal coder %v\", c)\n\t}\n}\n\n// AddMulti adds the given coders to the set and returns their ids. Idempotent.\nfunc (b *CoderMarshaller) AddMulti(list []*coder.Coder) ([]string, error) {\n\tvar ids []string\n\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.","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/coder.go#L564-L600","documentation":"Produced by CoderMarshaller.Add's default branch when the coder's Kind matches none of the handled cases (Custom, KV, Window, Timer, Iterable, Bool, Bytes, etc.). It signals an unsupported or unrecognized coder kind in the model marshalling switch, then wrapped with 'failed to marshal coder' context.","triggerScenarios":"Add/AddMulti receives a *coder.Coder whose Kind is not implemented by the marshaller — typically a hand-constructed coder or one produced by a newer/other SDK with a kind this Go version does not know.","commonSituations":"Version skew between Beam SDKs in cross-language pipelines; custom coders registered in one SDK but not Go; building coder.Coder values manually with an invalid zero-value Kind.","solutions":["Print/log c.Kind to identify the unsupported kind value.","Upgrade the Go Beam SDK so the marshaller recognizes the coder kind.","Replace the coder with a supported built-in (bytes, KV, iterable, windowed).","If custom, use coder.NewCustomCoder with valid Encode/Decode functions, which takes the Custom branch instead.","Check for version mismatch between pipeline-construction SDK and the Go container/runner."],"exampleFix":"// before\nc := &coder.Coder{Kind: coder.Kind(999), T: typex.New(typex.VarIntType)}\n// after\nc := coder.NewI( /* int64 element */ ) // use a known constructor so Kind is valid","handlingStrategy":"type-guard","validationCode":"switch c.Kind {\ncase coder.Custom, coder.KV, coder.Window, coder.Timer, coder.Iterable, coder.Bool, coder.Bytes:\n    // ok\ndefault:\n    return fmt.Errorf(\"kind %v not marshalable\", c.Kind)\n}","typeGuard":"func hasMarshalableKind(c *coder.Coder) bool {\n    k := c.Kind\n    return k == coder.Custom || k == coder.KV || k == coder.Window || k == coder.Timer || k == coder.Iterable || k == coder.Bool || k == coder.Bytes\n}","tryCatchPattern":"id, err := b.Add(c)\nif err != nil && strings.Contains(err.Error(), \"unexpected coder kind\") {\n    return \"\", fmt.Errorf(\"coder %v uses unsupported kind %v; upgrade SDK or replace coder\", c, c.Kind)\n}","preventionTips":["Always build coders via exported constructors, never struct literals with raw Kind values.","Pin matching Beam versions across all pipeline SDKs.","Keep custom coders on the coder.Custom path with registered Encode/Decode."],"tags":["go","apache-beam","serialization","unsupported-coder-kind"],"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"}