apache/beam · error

unknown atomic type: %v

Error message

unknown atomic type: %v

What it means

Thrown by Registry.fieldTypeToReflectType when a pipepb.FieldType has an AtomicType value not present in the atomicTypeToReflectType lookup. This means the schema carries an atomic enum the Go registry does not know how to turn into a reflect.Type.

Source

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

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

func (r *Registry) fieldTypeToReflectType(sft *pipepb.FieldType, opts []*pipepb.Option) (reflect.Type, error) {
	var t reflect.Type
	switch sft.GetTypeInfo().(type) {
	case *pipepb.FieldType_AtomicType:
		var ok bool
		if t, ok = atomicTypeToReflectType[sft.GetAtomicType()]; !ok {
			return nil, errors.Errorf("unknown atomic type: %v", sft.GetAtomicType())
		}
	case *pipepb.FieldType_ArrayType:
		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:

View on GitHub (pinned to 12126d8942)

Solutions

  1. Upgrade the Go SDK so atomicTypeToReflectType covers the enum in the schema
  2. Identify the offending AtomicType from the error text and change the producer to an atomic type Go supports
  3. Wrap the value in a logical type that maps to a supported atomic (e.g. string) on the producer side
  4. Log/inspect sft.GetAtomicType() and add a local mapping if you control the registry

Example fix

// before: producer uses AtomicType_DECIMAL unsupported in Go SDK vX
// after: producer encodes amount as AtomicType_STRING (or upgrade Go SDK to a version mapping DECIMAL)
Defensive patterns

Strategy: try-catch

Try / catch

t, err := registry.ToType(s)
if err != nil && strings.Contains(err.Error(), "unknown atomic type") {
  return fmt.Errorf("schema uses an atomic type unsupported by this Go SDK: %w", err)
}

Prevention

When it happens

Trigger: ToType/fieldToStructField on a schema produced by another SDK or a newer Beam version whose pipepb.AtomicType enum value has no entry in atomicTypeToReflectType (e.g. DECIMAL or newer atomics without Go mapping).

Common situations: Cross-language pipelines where Java/Python write schemas containing atomic types Go doesn't map; running an older Go SDK against schemas emitted by a newer pipeline/runner.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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