{"record":{"id":"7c4d49a8281ad2c3","repo":"apache/beam","slug":"unable-to-provide-schema-logicaltype-for-type-v-want-v","errorCode":null,"errorMessage":"unable to provide schema.LogicalType for type %v, want %v","messagePattern":"unable to provide schema\\.LogicalType for type (.+?), want (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/transforms/xlang/python/external.go","lineNumber":84,"sourceCode":"//\n//\timport math\n//\n//\tdef helper(x):\n//\t    return x * x\n//\n//\tdef func(y):\n//\t    return helper(y) + y\n//\n// in which case `func` would get applied to each element.\ntype CallableSource string\n\n// callableSourceProvider implement the SchemaProvider interface for logical types\ntype callableSourceProvider struct{}\n\n// FromLogicalType returns the goType of the logical type\nfunc (p *callableSourceProvider) FromLogicalType(rt reflect.Type) (reflect.Type, error) {\n\tif rt != pcsType {\n\t\treturn nil, fmt.Errorf(\"unable to provide schema.LogicalType for type %v, want %v\", rt, pcsType)\n\t}\n\treturn pcsStorageType, nil\n}\n\n// BuildEncoder encodes the PythonCallableSource logical type\nfunc (p *callableSourceProvider) BuildEncoder(rt reflect.Type) (func(any, io.Writer) error, error) {\n\tif _, err := p.FromLogicalType(rt); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn func(iface any, w io.Writer) error {\n\t\tv := iface.(CallableSource)\n\t\treturn coder.EncodeStringUTF8(string(v), w)\n\t}, nil\n}\n\n// BuildDecoder decodes the PythonCallableSource logical type\nfunc (p *callableSourceProvider) BuildDecoder(rt reflect.Type) (func(io.Reader) (any, error), error) {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/transforms/xlang/python/external.go#L66-L102","documentation":"callableSourceProvider.FromLogicalType can only convert the specific PythonCallableSource logical type (pcsType); any other reflect.Type is unsupported and returns this error. It is part of the xlang Python external type mapping. Callers should only invoke this provider for the expected logical type.","triggerScenarios":"schema.LogicalType resolution calls FromLogicalType with a reflect.Type other than the registered pcsType — usually from a mismatched or hand-constructed logical type registration.","commonSituations":"Manually registering the provider against the wrong Go type; version drift between the Python-side logical type URN and the Go provider.","solutions":["Ensure the logical type is registered only for PythonCallableSource's type","Check that the URN/type pairing in the pipeline payload matches the Go provider","Return this error from your own FromLogicalType only for unmatched types","Update Beam versions on both sides so logical type identifiers agree"],"exampleFix":"// before\nprovider.FromLogicalType(reflect.TypeOf(MyType{})) // wrong type\n// after\nprovider.FromLogicalType(pcsType) // the PythonCallableSource type","handlingStrategy":"try-catch","validationCode":"if rt != pcsType {\n    return fmt.Errorf(\"unsupported logical type %v\", rt)\n}","typeGuard":null,"tryCatchPattern":"rt, err := provider.FromLogicalType(lt)\nif err != nil {\n    return nil, fmt.Errorf(\"logical type resolution: %w\", err)\n}","preventionTips":["Register the provider only for its documented logical type","Keep Python/Go side URNs in sync","Handle the error at registration time"],"tags":["go","apache-beam","xlang","schema","logical-type"],"backgroundTag":"type-mismatch","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"}