apache/beam · error

unable to map %v to pipepb.AtomicType

Error message

unable to map %v to pipepb.AtomicType

What it means

Fallback error in reflectTypeToFieldType: the type's Kind was not in the unsupported-kinds blacklist and not present in reflectTypeToAtomicTypeMap, so no pipepb.AtomicType mapping exists. This catches kinds the switch fell through to the 'atomic' default but that Beam has no atomic representation for (e.g. uintptr, or exotic integer widths).

Source

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

		}
		return &pipepb.FieldType{
			TypeInfo: &pipepb.FieldType_ArrayType{
				ArrayType: &pipepb.ArrayType{
					ElementType: vt,
				},
			},
		}, nil
	case reflect.Interface, reflect.Func, reflect.Chan, reflect.UnsafePointer, reflect.Complex128, reflect.Complex64, reflect.Invalid:
		return nil, errors.Errorf("unable to convert unsupported type %v to schema", ot)
	default: // must be an atomic type
		if enum, ok := reflectTypeToAtomicTypeMap[t.Kind()]; ok {
			return &pipepb.FieldType{
				TypeInfo: &pipepb.FieldType_AtomicType{
					AtomicType: enum,
				},
			}, nil
		}
		return nil, errors.Errorf("unable to map %v to pipepb.AtomicType", t)
	}
}

var reflectTypeToAtomicTypeMap = map[reflect.Kind]pipepb.AtomicType{
	reflect.Uint8:   pipepb.AtomicType_BYTE,
	reflect.Int16:   pipepb.AtomicType_INT16,
	reflect.Int32:   pipepb.AtomicType_INT32,
	reflect.Int64:   pipepb.AtomicType_INT64,
	reflect.Float32: pipepb.AtomicType_FLOAT,
	reflect.Float64: pipepb.AtomicType_DOUBLE,
	reflect.String:  pipepb.AtomicType_STRING,
	reflect.Bool:    pipepb.AtomicType_BOOLEAN,
}

var reflectKindToTypeMap = map[reflect.Kind]reflect.Type{
	reflect.Uint:    reflectx.Uint,
	reflect.Uint8:   reflectx.Uint8,
	reflect.Uint16:  reflectx.Uint16,

View on GitHub (pinned to 12126d8942)

Solutions

  1. Change the field to a supported atomic type (int32/int64/float64/string/bool/[]byte etc.)
  2. Register the type with schema.RegisterLogicalType to map it to an atomic representation
  3. Check the reflectTypeToAtomicTypeMap in your Beam version for the list of supported kinds
  4. Convert the value explicitly before placing it in a schema-encoded struct

Example fix

// before
type H struct { Handle uintptr }
// after
type H struct { Handle uint64 }
Defensive patterns

Strategy: validation

Validate before calling

k := field.Kind()
if _, ok := supportedAtomicKinds[k]; !ok && k != reflect.Struct && k != reflect.Slice && k != reflect.Map {
  return fmt.Errorf("kind %v has no atomic schema mapping", k)
}

Try / catch

_, err := schema.FromType(t)
if err != nil && strings.Contains(err.Error(), "pipepb.AtomicType") {
  return fmt.Errorf("field kind lacks atomic mapping: %w", err)
}

Prevention

When it happens

Trigger: Schema-encoding a struct whose field Kind is not in reflectTypeToAtomicTypeMap — e.g. uintptr, or a named type whose underlying kind is missing from the map.

Common situations: Using uintptr-typed handles or less common numeric kinds in Podo structs; also triggered when Beam adds new atomic types but user code relies on an older map.

Related errors


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