{"record":{"id":"b94492eae1c21fe4","repo":"apache/beam","slug":"unencodable-type-v","errorCode":null,"errorMessage":"unencodable type '%v'","messagePattern":"unencodable type '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/serialize.go","lineNumber":511,"sourceCode":"\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad channel direction\")\n\t\t\treturn nil, errors.WithContextf(wrapped, \"encoding channel %v\", t)\n\t\t}\n\t\treturn &v1pb.Type{Kind: v1pb.Type_CHAN, Element: elm, ChanDir: dir}, nil\n\n\tcase reflect.Ptr:\n\t\telm, err := encodeType(t.Elem())\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad base type\")\n\t\t\treturn nil, errors.WithContextf(wrapped, \"encoding pointer %v\", t)\n\t\t}\n\t\treturn &v1pb.Type{Kind: v1pb.Type_PTR, Element: elm}, nil\n\n\tcase reflect.Map, reflect.Array:\n\t\treturn nil, errors.Errorf(\"unencodable type '%v', try to wrap the type as a field in a struct, see https://github.com/apache/beam/issues/23101 for details\", t.Kind())\n\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unencodable type '%v'\", t.Kind())\n\t}\n}\n\nfunc tryEncodeSpecial(t reflect.Type) (v1pb.Type_Special, bool) {\n\tswitch t {\n\tcase reflectx.Error:\n\t\treturn v1pb.Type_ERROR, true\n\tcase reflectx.Context:\n\t\treturn v1pb.Type_CONTEXT, true\n\tcase reflectx.Type:\n\t\treturn v1pb.Type_TYPE, true\n\n\tcase typex.EventTimeType:\n\t\treturn v1pb.Type_EVENTTIME, true\n\tcase typex.WindowType:\n\t\treturn v1pb.Type_WINDOW, true\n\tcase typex.BundleFinalizationType:\n\t\treturn v1pb.Type_BUNDLEFINALIZATION, true","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/serialize.go#L493-L529","documentation":"The default branch of encodeType returns 'unencodable type %v' for any reflect.Kind not explicitly handled (primitives, string, slice, struct, func, chan, ptr, unsafe pointer, etc. are handled; everything else like complex, uintptr, chan-less kinds fall here). It means the type is outside graphx's supported serialization surface.","triggerScenarios":"Encoding exotic kinds such as reflect.Complex64/Complex128, reflect.Uintptr, reflect.UnsafePointer, or Invalid as part of a pipeline graph type.","commonSituations":"Users pass element types containing complex numbers or uintptr values in DoFn signatures; also appears when reflection yields an invalid/zero type from badly constructed generic code.","solutions":["Replace the unsupported kind with an encodable one (struct/slice of primitives)","Represent complex numbers as a struct of two float64 fields","Remove uintptr/unsafe usage from pipeline types","Add a custom coder if the type is genuinely needed"],"exampleFix":"// before\ntype Signal struct { Amp complex128 }\n// after\ntype Signal struct { Real, Imag float64 }","handlingStrategy":"validation","validationCode":"unsupported := map[reflect.Kind]bool{\n\treflect.Complex64: true, reflect.Complex128: true,\n\treflect.Uintptr: true, reflect.UnsafePointer: true,\n}\nif unsupported[t.Kind()] { return fmt.Errorf(\"kind %v not supported by graphx\", t.Kind()) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid complex numbers and uintptr in pipeline data types","Model complex numbers as struct{Re, Im float64}","Keep DoFn signatures limited to primitives, strings, slices and structs"],"tags":["go","serialization","apache-beam"],"backgroundTag":"unsupported-operation","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"}