{"record":{"id":"064a734f4921a661","repo":"apache/beam","slug":"failed-to-marshal-nullable-coder-v","errorCode":null,"errorMessage":"failed to marshal Nullable coder %v","messagePattern":"failed to marshal Nullable coder (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/coder.go","lineNumber":486,"sourceCode":"\t\tinner := b.internCoder(&pipepb.Coder{\n\t\t\tSpec: &pipepb.FunctionSpec{\n\t\t\t\tUrn:     urnCustomCoder,\n\t\t\t\tPayload: []byte(data),\n\t\t\t},\n\t\t})\n\t\treturn b.internBuiltInCoder(urnLengthPrefixCoder, inner), nil\n\n\tcase coder.KV:\n\t\tcomp, err := b.AddMulti(c.Components)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to marshal KV coder %v\", c)\n\t\t}\n\t\treturn b.internBuiltInCoder(urnKVCoder, comp...), nil\n\n\tcase coder.Nullable:\n\t\tcomp, err := b.AddMulti(c.Components)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to marshal Nullable coder %v\", c)\n\t\t}\n\t\treturn b.internBuiltInCoder(urnNullableCoder, comp...), nil\n\n\tcase coder.CoGBK:\n\t\tcomp, err := b.AddMulti(c.Components)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to marshal CoGBK coder %v\", c)\n\t\t}\n\t\tvalue := comp[1]\n\t\tif len(comp) > 2 {\n\t\t\t// TODO(https://github.com/apache/beam/issues/18032): don't inject union coder for CoGBK.\n\n\t\t\tunion := b.internBuiltInCoder(urnCoGBKList, comp[1:]...)\n\t\t\tvalue = b.internBuiltInCoder(urnLengthPrefixCoder, union)\n\t\t}\n\n\t\t// SDKs always provide iterableCoder to runners, but can receive StateBackedIterables in return.\n\t\tstream := b.internBuiltInCoder(urnIterableCoder, value)","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/coder.go#L468-L504","documentation":"Wrap returned by the coder marshaling path in Add when interning the component(s) of a coder.Nullable fails. The inner AddMulti error is wrapped with the coder being serialized; the real cause is in the wrapped error and usually means an inner (component) coder failed to marshal to its pipeline-proto representation.","triggerScenarios":"CoderBuilder.Add on a coder.Nullable whose element component coder fails to marshal.","commonSituations":"Nullable PCollections over custom types that were not registered; nested coders where the inner error names the real culprit.","solutions":["Inspect the wrapped error to identify the failing component","Register the element type with beam.RegisterType before beam.Init","Use a supported element type for the nullable coder","Upgrade the Beam Go SDK if support is missing"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Unwrap and log the inner component failure\nif err != nil && strings.Contains(err.Error(), \"Nullable\") {\n    log.Printf(\"nullable component failure: %v\", errors.Unwrap(err))\n}","preventionTips":["Register nullable element types before beam.Init","Keep nullable element types to supported kinds","Catch the error during pipeline build, before submission"],"tags":["beam","go","coder","nullable"],"backgroundTag":"json-marshal-failed","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"}