{"record":{"id":"28557684416c1a21","repo":"apache/beam","slug":"unable-to-convert-map-value-type","errorCode":null,"errorMessage":"unable to convert map value type","messagePattern":"unable to convert map value type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go","lineNumber":782,"sourceCode":"\tcase *pipepb.FieldType_AtomicType:\n\t\tvar ok bool\n\t\tif t, ok = atomicTypeToReflectType[sft.GetAtomicType()]; !ok {\n\t\t\treturn nil, errors.Errorf(\"unknown atomic type: %v\", sft.GetAtomicType())\n\t\t}\n\tcase *pipepb.FieldType_ArrayType:\n\t\trt, err := r.fieldTypeToReflectType(sft.GetArrayType().GetElementType(), nil)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to convert array element type\")\n\t\t}\n\t\tt = reflect.SliceOf(rt)\n\tcase *pipepb.FieldType_MapType:\n\t\tkt, err := r.fieldTypeToReflectType(sft.GetMapType().GetKeyType(), nil)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to convert map key type\")\n\t\t}\n\t\tvt, err := r.fieldTypeToReflectType(sft.GetMapType().GetValueType(), nil)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to convert map value type\")\n\t\t}\n\t\tt = reflect.MapOf(kt, vt) // Panics for invalid map keys (slices/iterables)\n\tcase *pipepb.FieldType_RowType:\n\t\trt, err := r.toType(sft.GetRowType().GetSchema())\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"unable to convert row type: %v\", sft.GetRowType().GetSchema().GetId())\n\t\t}\n\t\tt = rt\n\t// case *pipepb.FieldType_IterableType:\n\t// TODO(BEAM-9615): handle IterableTypes (eg. CoGBK values)\n\n\tcase *pipepb.FieldType_LogicalType:\n\t\tlst := sft.GetLogicalType()\n\t\tidentifier := lst.GetUrn()\n\t\tlt, ok := r.logicalTypes[identifier]\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"unknown logical type: %v\", identifier)\n\t\t}","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go#L764-L800","documentation":"This error is produced by schema.go's fieldTypeToReflectType when converting a protobuf Schema FieldType with a MapType into a Go reflect.Type. It wraps a lower-level failure returned while converting the map's VALUE type to a reflect.Type (the key type already converted fine). The library throws it because a schema whose value field type cannot be represented in Go cannot be materialized as a struct field.","triggerScenarios":"Calling fieldTypeToReflectType (via fieldToStructField or recursively) on a *pipepb.FieldType whose MapType.ValueType is a RowType with an invalid schema, an unregistered LogicalType, or otherwise unconvertible FieldType; the inner error propagates up and gets wrapped here.","commonSituations":"Decoding a pipeline graph whose serialized schema contains map values of logical types not registered in the local logicalTypes registry (e.g. after Beam SDK version changes or custom logical types not registered on the receiving side); remote workers converting schemas created by a Python/Java pipeline.","solutions":["Inspect the wrapped inner error to find which value FieldType failed conversion","Register the missing logical type with the schema registry (RegisterLogicalType / known logical types) before decoding","Simplify the map value type in your schema (e.g. use RowType of primitives instead of a custom logical type)","Update the Beam Go SDK to a version that supports the value field type (see TODO BEAM-9615 iterable support)"],"exampleFix":"// before\nlt, ok := r.logicalTypes[\"com.myco.CustomType\"] // not registered -> unknown logical type\n// after\nimport \"github.com/apache/beam/sdks/go/pkg/beam/core/runtime/graphx/schema\"\nschema.RegisterLogicalType(myCustomLogicalType{}) // register before decoding","handlingStrategy":"validation","validationCode":"for k, v := range schema.Fields {\n  if mt := v.GetType().GetMapType(); mt != nil {\n    if err := validateFieldType(mt.GetValueType(), registry); err != nil {\n      return fmt.Errorf(\"map field %q: %w\", k, err)\n    }\n  }\n}","typeGuard":"func isConvertible(ft *pipepb.FieldType, r *Representer) bool {\n  switch ft.GetTypeInfo().(type) {\n  case *pipepb.FieldType_RowType:\n    return r.hasSchema(ft.GetRowType().GetSchema().GetId())\n  case *pipepb.FieldType_LogicalType:\n    _, ok := r.logicalTypes[ft.GetLogicalType().GetUrn()]\n    return ok\n  default:\n    return true\n  }\n}","tryCatchPattern":"if t, err := fieldTypeToReflectType(sft, nil); err != nil {\n  var unknown schema.UnknownTypeError\n  if errors.As(err, &unknown) { /* register logical type and retry */ }\n  return fmt.Errorf(\"field %s: %w\", name, err)\n}","preventionTips":["Register every custom logical type in init() before schema conversion","Keep Beam Go SDK versions identical on submit and worker sides","Avoid custom logical types in map value positions in cross-language schemas","Log wrapped inner errors to pinpoint the failing nested field"],"tags":["go","beam","schema","reflection"],"backgroundTag":"schema-validation-failed","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"}