{"record":{"id":"f96ca8108255e860","repo":"apache/beam","slug":"unexpected-type-kind-v-class","errorCode":null,"errorMessage":"Unexpected type kind: %v","messagePattern":"Unexpected type kind: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/typex/class.go","lineNumber":197,"sourceCode":"\t\treturn nil\n\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn nil\n\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\treturn nil\n\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn nil\n\n\tcase reflect.Complex64, reflect.Complex128:\n\t\treturn nil\n\n\tcase reflect.String:\n\t\treturn nil\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Unexpected type kind: %v\", t))\n\t}\n}\n\n// IsContainer returns true iff the given type is an container data type,\n// such as []int or []T.\nfunc IsContainer(t reflect.Type) bool {\n\t// TODO(lostluck) 2019.02.03: Should we consider maps a container for\n\t// beam specific purposes?\n\tswitch {\n\tcase IsList(t):\n\t\tif IsUniversal(t.Elem()) || IsConcrete(t.Elem()) {\n\t\t\treturn true\n\t\t}\n\t\treturn IsContainer(t.Elem())\n\tdefault:\n\t\treturn false\n\t}\n}","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/typex/class.go#L179-L215","documentation":"isConcrete validates that a reflect.Type of a given class has a supported kind; kinds outside Bool, Integer, Float, Byte and String hit this panic. It is an internal completeness guard over Go's reflect.Kind space, reached only when the SDK encounters a kind it does not know how to classify as concrete.","triggerScenarios":"Calling typex.IsConcrete/CheckConcrete (or building a FullType) with a type whose underlying kind is not one of the handled kinds, e.g. a struct, map, func, or pointer type passed where a concrete data type is expected.","commonSituations":"Passing struct or map types directly as pipeline data where KV/slices/primitives are expected; custom type wrappers around unsupported kinds; SDK gaps for newer Go kinds.","solutions":["Check the reflect.Kind of the type you pass; use only concrete encodable kinds (bool, ints, uints, floats, string, byte, slices of these).","Wrap complex types with beam.Encoder/beam.Decoder registrations instead of relying on default concreteness.","Use KV, slices, or primitives for PCollection elements rather than raw struct/map/func types."],"exampleFix":"// before\nvar t = reflect.TypeOf(map[string]int{})\ntypex.CheckConcrete(typex.Composite, t, nil) // panics on map kind\n// after\nvar t = reflect.TypeOf([]int{})\ntypex.CheckConcrete(typex.Container, t, nil)","handlingStrategy":"validation","validationCode":"k := t.Kind()\nswitch k {\ncase reflect.Bool, reflect.Int, reflect.Int8, ..., reflect.String:\n\t// ok\ndefault:\n\treturn fmt.Errorf(\"unsupported kind for concrete type: %v\", k)\n}","typeGuard":"func isSupportedKind(t reflect.Type) bool {\n\tswitch t.Kind() {\n\tcase reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\treflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,\n\t\treflect.Float32, reflect.Float64, reflect.String:\n\t\treturn true\n\t}\n\treturn false\n}","tryCatchPattern":"defer func() {\n\tif r := recover(); r != nil {\n\t\tlog.Printf(\"unsupported kind %v: %v\", t.Kind(), r)\n\t}\n}()","preventionTips":["Keep PCollection element types to primitives, strings, byte slices, and KV composites.","Check reflect.Kind before passing types into typex helpers.","Register custom encoders/decoders for complex types instead of relying on default concreteness."],"tags":["go","beam","typex","reflect","unsupported-type"],"backgroundTag":"unsupported-dtype","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"}