{"record":{"id":"47d9cafb5adf33c6","repo":"apache/beam","slug":"unable-to-convert-unsupported-type-v-to-schema","errorCode":null,"errorMessage":"unable to convert unsupported type %v to schema","messagePattern":"unable to convert unsupported type (.+?) to schema","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go","lineNumber":644,"sourceCode":"\t\t\treturn &pipepb.FieldType{\n\t\t\t\tTypeInfo: &pipepb.FieldType_AtomicType{\n\t\t\t\t\tAtomicType: pipepb.AtomicType_BYTES,\n\t\t\t\t},\n\t\t\t}, nil\n\t\t}\n\t\tvt, err := r.reflectTypeToFieldType(t.Elem())\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"unable to convert element type of %v to schema field\", ot)\n\t\t}\n\t\treturn &pipepb.FieldType{\n\t\t\tTypeInfo: &pipepb.FieldType_ArrayType{\n\t\t\t\tArrayType: &pipepb.ArrayType{\n\t\t\t\t\tElementType: vt,\n\t\t\t\t},\n\t\t\t},\n\t\t}, nil\n\tcase reflect.Interface, reflect.Func, reflect.Chan, reflect.UnsafePointer, reflect.Complex128, reflect.Complex64, reflect.Invalid:\n\t\treturn nil, errors.Errorf(\"unable to convert unsupported type %v to schema\", ot)\n\tdefault: // must be an atomic type\n\t\tif enum, ok := reflectTypeToAtomicTypeMap[t.Kind()]; ok {\n\t\t\treturn &pipepb.FieldType{\n\t\t\t\tTypeInfo: &pipepb.FieldType_AtomicType{\n\t\t\t\t\tAtomicType: enum,\n\t\t\t\t},\n\t\t\t}, nil\n\t\t}\n\t\treturn nil, errors.Errorf(\"unable to map %v to pipepb.AtomicType\", t)\n\t}\n}\n\nvar reflectTypeToAtomicTypeMap = map[reflect.Kind]pipepb.AtomicType{\n\treflect.Uint8:   pipepb.AtomicType_BYTE,\n\treflect.Int16:   pipepb.AtomicType_INT16,\n\treflect.Int32:   pipepb.AtomicType_INT32,\n\treflect.Int64:   pipepb.AtomicType_INT64,\n\treflect.Float32: pipepb.AtomicType_FLOAT,","sourceCodeStart":626,"sourceCodeEnd":662,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go#L626-L662","documentation":"Thrown when reflectTypeToFieldType encounters a Go type of a fundamentally unsupported reflect.Kind: Interface, Func, Chan, UnsafePointer, Complex128, Complex64, or Invalid. Beam schemas have no representation for these kinds, so conversion fails immediately with this non-wrapped error.","triggerScenarios":"Any schema encoding path (RegisterLogicalType, structToSchema, ToType round-trip) that reaches a field or nested type whose reflect.Kind is one of the unsupported kinds listed in the switch.","commonSituations":"Structs containing callback fields, dependency-injection interfaces, channels, or complex numbers passed to Beam pipelines that use schema coders; also a nil/invalid reflect.Type slipping in from a failed lookup.","solutions":["Remove the unsupported-kind field from the struct or replace it with a concrete supported type","Use schema.RegisterAssignableType to map the type onto a convertible representation","Encode the data as bytes/string with custom serialization before it enters the pipeline","Use a non-schema coder (cache.CustomTypeEncoder/Decoder) for the affected type"],"exampleFix":"// before\ntype Job struct { Done chan struct{} }\n// after\ntype Job struct { Done bool }","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func schemaSupportedKind(k reflect.Kind) bool {\n  switch k {\n  case reflect.Interface, reflect.Func, reflect.Chan, reflect.UnsafePointer, reflect.Complex128, reflect.Complex64, reflect.Invalid:\n    return false\n  }\n  return true\n}","tryCatchPattern":"if err := isSchemaSafe(t); err != nil {\n  return fmt.Errorf(\"type %v uses an unsupported kind: %w\", t, err)\n}","preventionTips":["Lint or code-review pipeline structs for chan/func/interface/complex fields","Move non-data fields (closures, channels) out of serialized payload structs","Use custom coders for inherently non-schema types"],"tags":["go","apache-beam","schema","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}