{"record":{"id":"2d71ca8dd8c0fa70","repo":"apache/beam","slug":"logicaltype-v-has-an-invalid-storagetype-v-v","errorCode":null,"errorMessage":"LogicalType[%v] has an invalid StorageType %v: %v","messagePattern":"LogicalType\\[(.+?)\\] has an invalid StorageType (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/schema/logicaltypes.go","lineNumber":96,"sourceCode":"func NewRegistry() *Registry {\n\treturn &Registry{\n\t\ttypeToSchema:    map[reflect.Type]*pipepb.Schema{},\n\t\tidToType:        map[string]reflect.Type{},\n\t\tsyntheticToUser: map[reflect.Type]reflect.Type{},\n\n\t\tlogicalTypes:           map[string]LogicalType{},\n\t\tlogicalTypeIdentifiers: map[reflect.Type]string{},\n\t\tlogicalTypeProviders:   map[reflect.Type]LogicalTypeProvider{},\n\t}\n}\n\n// RegisterLogicalType a single logical type.\nfunc (r *Registry) RegisterLogicalType(lt LogicalType) {\n\t// Validates that the storage type has known handling.\n\tst := lt.StorageType()\n\t_, err := r.reflectTypeToFieldType(st)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"LogicalType[%v] has an invalid StorageType %v: %v\", lt.ID(), st, err))\n\t}\n\tif len(lt.ID()) == 0 {\n\t\tpanic(fmt.Sprintf(\"invalid logical type, bad id: %v -> %v\", lt.GoType(), lt.StorageType()))\n\t}\n\t// TODO add duplication checks.\n\tr.logicalTypeIdentifiers[lt.GoType()] = lt.ID()\n\tr.logicalTypes[lt.ID()] = lt\n}\n\n// RegisterLogicalTypeProvider allows registration of providers for interface types.\nfunc (r *Registry) RegisterLogicalTypeProvider(rt reflect.Type, ltp LogicalTypeProvider) {\n\tif rt.Kind() != reflect.Interface {\n\t\tpanic(fmt.Sprintf(\"Logical Types must be registered with interface types. %v is not an interface type.\", rt))\n\t}\n\tif rt.NumMethod() == 0 {\n\t\tpanic(fmt.Sprintf(\"Logical Types may not be registered with empty interface types. %v has no methods.\", rt))\n\t}\n\tr.logicalTypeProviders[rt] = ltp","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/schema/logicaltypes.go#L78-L114","documentation":"Registry.RegisterLogicalType validates that a LogicalType's StorageType has known schema handling by calling reflectTypeToFieldType. If the storage type cannot be mapped to a schema field type, registration panics, since the logical type could never be encoded in the schema protocol.","triggerScenarios":"Registering a LogicalType whose StorageType() returns a Go type unsupported by the schema package (e.g. a struct, map, or other unhandled kind) via RegisterLogicalType, registerType, or preRegLogicalTypes.","commonSituations":"Implementing a custom logical type with a composite or pointer storage type; typos returning the wrong type from StorageType(); SDK versions lacking handling for a newer storage type.","solutions":["Change StorageType() to return a supported primitive/known type (e.g. []byte, string, int64)","Check the schema package's reflectTypeToFieldType for supported kinds and register additional field type handling if available","Implement custom row encoding via a wrapper type with a supported storage type"],"exampleFix":"// before\nfunc (t myLT) StorageType() reflect.Type { return reflect.TypeOf(map[string]string{}) }\n// after\nfunc (t myLT) StorageType() reflect.Type { return reflect.TypeOf(\"\") }","handlingStrategy":"validation","validationCode":"st := lt.StorageType()\nswitch st.Kind() {\ncase reflect.Slice, reflect.String, reflect.Int64, reflect.Bool, reflect.Float64:\ndefault:\n    return fmt.Errorf(\"unsupported storage type: %v\", st)\n}","typeGuard":null,"tryCatchPattern":"defer func() { if r := recover(); r != nil { err = fmt.Errorf(\"register logical type: %v\", r) } }()","preventionTips":["Model StorageType() on existing logical types in the schema package","Keep storage types primitive or []byte","Test custom logical types with round-trip encode/decode"],"tags":["go","apache-beam","schema","logical-type","panic"],"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"}