apache/beam · error

unable to convert row type

Error message

unable to convert row type: %v

What it means

Wraps a failure from r.toType() when converting a RowType's embedded Schema into a Go reflect.Type during map/row field conversion in schema.go. The schema ID is included in the message for diagnosis. It is thrown because a nested row's schema could not be translated (bad fields, unregistered logical types, etc.).

Solutions

  1. Read the wrapped inner error and the schema id in the message to locate the offending nested row
  2. Ensure all logical types used in nested rows are registered in the Go process
  3. Adjust the schema on the producing side to use Go-representable field types
  4. Check schema encoding completeness when transporting graphs across language boundaries

Example fix

// before
schema with field "meta" of unregistered logical type "myco:custom"
// after
schema.RegisterLogicalType(mycoCustomType{}) before toType/schema decoding, or change the field to a RowType of primitives
Defensive patterns

Strategy: validation

Validate before calling

for _, f := range rowType.GetSchema().GetFields() {
  if !goRepresentable(f.GetType()) { return fmt.Errorf("schema %s field %q unrepresentable", rowType.GetSchema().GetId(), f.GetName()) }
}

Type guard

func hasRegisteredLogicalTypes(s *pipepb.Schema, known map[string]bool) bool {
  for _, f := range s.GetFields() {
    if lt := f.GetType().GetLogicalType(); lt != nil && !known[lt.GetUrn()] { return false }
  }
  return true
}

Try / catch

rt, err := r.toType(rowSchema)
if err != nil { return fmt.Errorf("row %s: %w", rowSchema.GetId(), err) }

Prevention

When it happens

Trigger: fieldTypeToReflectType encountering *pipepb.FieldType_RowType whose GetSchema() fails toType conversion — e.g. a nested row containing a logical type missing from r.logicalTypes or a field type unknown to the Go converter.

Common situations: Cross-language pipelines (Python/Java producer, Go consumer) where nested rows carry types the Go SDK cannot represent; schema IDs referencing schemas not present in the encoded components.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

		rt, err := r.fieldTypeToReflectType(sft.GetArrayType().GetElementType(), nil)
		if err != nil {
			return nil, errors.Wrap(err, "unable to convert array element type")
		}
		t = reflect.SliceOf(rt)
	case *pipepb.FieldType_MapType:
		kt, err := r.fieldTypeToReflectType(sft.GetMapType().GetKeyType(), nil)
		if err != nil {
			return nil, errors.Wrap(err, "unable to convert map key type")
		}
		vt, err := r.fieldTypeToReflectType(sft.GetMapType().GetValueType(), nil)
		if err != nil {
			return nil, errors.Wrap(err, "unable to convert map value type")
		}
		t = reflect.MapOf(kt, vt) // Panics for invalid map keys (slices/iterables)
	case *pipepb.FieldType_RowType:
		rt, err := r.toType(sft.GetRowType().GetSchema())
		if err != nil {
			return nil, errors.Wrapf(err, "unable to convert row type: %v", sft.GetRowType().GetSchema().GetId())
		}
		t = rt
	// case *pipepb.FieldType_IterableType:
	// TODO(BEAM-9615): handle IterableTypes (eg. CoGBK values)

	case *pipepb.FieldType_LogicalType:
		lst := sft.GetLogicalType()
		identifier := lst.GetUrn()
		lt, ok := r.logicalTypes[identifier]
		if !ok {
			return nil, errors.Errorf("unknown logical type: %v", identifier)
		}
		t = lt.GoType()

	default:
		return nil, errors.Errorf("unknown fieldtype: %T", sft.GetTypeInfo())
	}
	if sft.GetNullable() {

View on GitHub (pinned to 12126d8942)