apache/beam · error

unable to convert LogicalType

Error message

unable to convert LogicalType[%v] using provider for %v

What it means

registerType checks whether a type implements any registered LogicalType interface and, if so, invokes the corresponding provider function to convert it. If the provider returns an error, this error wraps it, naming the logical type and the provider interface.

Solutions

  1. Fix the logical type provider registered for that interface so it handles the type t or returns a nil schema to skip.
  2. Return (nil, nil) from the provider for types it does not support instead of an error.
  3. Check provider registration order and that the right provider is associated with the interface.

Example fix

// before
func provider(t reflect.Type) (*schema.Schema, error) { return nil, errors.New("unsupported") }
// after
func provider(t reflect.Type) (*schema.Schema, error) {
    if !supported(t) { return nil, nil } // skip, don't error
    ...
Defensive patterns

Strategy: fallback

Validate before calling

if !t.Implements(logicalTypeIface) {
    return nil, nil // skip instead of erroring
}

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "unable to convert LogicalType") {
        // fall back to RegisterLogicalType with a default representation
    }
}

Prevention

When it happens

Trigger: Registering a type that implements a registered logical-type interface whose provider callback p(t) fails — e.g. a custom logical type provider that cannot handle the specific type instance.

Common situations: User-registered logical type providers with incomplete handling logic; version mismatches where a provider expects a different underlying type shape; nil or misconfigured providers.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/82473f0a536c0eed. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go:234

	}
	seen[ut] = struct{}{}

	// Lets do some recursion to register fundamental type parts.
	t := ut
	if lID, ok := r.logicalTypeIdentifiers[t]; ok {
		lt := r.logicalTypes[lID]
		r.addToMaps(lt.StorageType(), t)
		return nil
	}

	for _, lti := range r.logicalTypeInterfaces {
		if !t.Implements(lti) {
			continue
		}
		p := r.logicalTypeProviders[lti]
		st, err := p(t)
		if err != nil {
			return errors.Wrapf(err, "unable to convert LogicalType[%v] using provider for %v", t, lti)
		}
		if st == nil {
			continue
		}
		r.RegisterLogicalType(ToLogicalType(t.String(), t, st))
		r.addToMaps(st, t)
		return nil
	}

	switch t.Kind() {
	case reflect.Map:
		if err := r.registerType(t.Key(), seen); err != nil {
			return err
		}
		fallthrough
	case reflect.Array, reflect.Slice, reflect.Ptr:
		if err := r.registerType(t.Elem(), seen); err != nil {
			return errors.Wrapf(err, "type is of kind %v", t.Kind())

View on GitHub (pinned to 12126d8942)