apache/beam · error

reconciling for FromType

Error message

reconciling for FromType

What it means

Registry.FromType wraps any error returned by reconcileRegistrations with this message before returning. reconcileRegistrations brings lazily-queued user type and logical type registrations into the registry before conversion; if that internal synchronization fails, FromType cannot proceed. The root cause is in the wrapped error, not in FromType's input type.

Solutions

  1. Inspect the wrapped inner error for the actual registration failure.
  2. Fix the type whose registration failed (usually an unsupported field kind inside a registered struct).
  3. Register problematic types eagerly and validate their conversion at startup rather than lazily.
  4. Unwrap the error chain to the root cause before debugging.

Example fix

// before
schm, err := reg.FromType(reflect.TypeOf(MyRow{})) // opaque wrapper
// after
if err != nil {
    for errors.Unwrap(err) != nil { err = errors.Unwrap(err) }
    log.Fatalf("root cause: %v", err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if err := reg.reconcileRegistrations(); err != nil { return fmt.Errorf("reconcile failed: %w", err) }

Try / catch

schm, err := reg.FromType(reflect.TypeOf(MyRow{}))
if err != nil {
    return fmt.Errorf("FromType: %w", err) // log full chain to find root cause
}

Prevention

When it happens

Trigger: Calling Registry.FromType(t) when reconcileRegistrations fails — i.e. an error occurs while processing pending registrations (registerType recursion over queued types, or conversion inside reconciliation).

Common situations: Registering a user type whose struct contains an unconvertible field, then calling FromType; failures during the first schema conversion of a lazily-registered type when building a pipeline graph.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

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

func (r *Registry) addToMaps(synth, ut reflect.Type) {
	synth = reflectx.SkipPtr(synth)
	ut = reflectx.SkipPtr(ut)
	// empty types have no value for lookups.
	if synth != emptyStructType {
		r.syntheticToUser[synth] = ut
		r.syntheticToUser[reflect.PtrTo(synth)] = reflect.PtrTo(ut)
	}
	if ut != emptyStructType {
		r.syntheticToUser[ut] = ut
		r.syntheticToUser[reflect.PtrTo(ut)] = reflect.PtrTo(ut)
	}
}

// FromType returns a Beam Schema of the passed in type.
// Returns an error if the type cannot be converted to a Schema.
func (r *Registry) FromType(ot reflect.Type) (*pipepb.Schema, error) {
	if err := r.reconcileRegistrations(); err != nil {
		return nil, errors.Wrap(err, "reconciling for FromType")
	}
	if reflectx.SkipPtr(ot).Kind() != reflect.Struct {
		return nil, errors.Errorf("cannot convert %v to schema. FromType only converts structs to schemas", ot)
	}
	return r.fromType(ot)
}

func (r *Registry) logicalTypeToFieldType(t reflect.Type) (*pipepb.FieldType, string, error) {
	// Check if a logical type was registered that matches this struct type directly
	// and if so, extract the schema from it for use.
	if lID, ok := r.logicalTypeIdentifiers[t]; ok {
		lt := r.logicalTypes[lID]
		ftype, err := r.reflectTypeToFieldType(lt.StorageType())
		if err != nil {
			return nil, "", errors.Wrapf(err, "unable to convert LogicalType[%v]'s storage type %v for Go type of %v to a schema", lID, lt.StorageType(), lt.GoType())
		}
		return ftype, lID, nil
	}

View on GitHub (pinned to 12126d8942)