apache/beam · error

Type " " of kind " " not permitted in concrete types. All…

Error message

Type "%v" of kind "%v" not permitted in concrete types. All types must be manageable.

What it means

isConcrete rejects element types whose Go kind is unmanageable: Invalid (nil/zero reflect.Type), UnsafePointer, or Uintptr. Beam cannot serialize, hash, or otherwise manage elements of these kinds, so any concrete type graph containing them is rejected. Reached via IsConcrete/CheckConcrete during type binding of PCollections and DoFn signatures.

Solutions

  1. Remove exported unsafe.Pointer/uintptr fields; store them unexported or convert to byte slices / fixed-size integer handles.
  2. Check for nil reflect.Type before calling typex.New or CheckConcrete.
  3. Replace unsafe interop patterns with encoding-safe representations (e.g. []byte, string, or uint64 IDs).
  4. Run typex.CheckConcrete(type) in a unit test to pinpoint which nested field violates manageability.

Example fix

// before
type Event struct {
    Handle unsafe.Pointer
}

// after
type Event struct {
    HandleID uint64
}
Defensive patterns

Strategy: validation

Validate before calling

func checkManageable(t reflect.Type) error {
    switch t.Kind() {
    case reflect.Invalid, reflect.UnsafePointer, reflect.Uintptr:
        return fmt.Errorf("unmanageable kind %v in %v", t.Kind(), t)
    }
    return nil
}

Type guard

func hasUnsafeKinds(t reflect.Type) bool {
    switch t.Kind() {
    case reflect.Invalid, reflect.UnsafePointer, reflect.Uintptr:
        return true
    }
    return false
}

Prevention

When it happens

Trigger: Binding a type containing unsafe.Pointer or uintptr fields (exported, recursively); passing a nil or zero-value reflect.Type into typex.New/CheckConcrete (Kind Invalid).

Common situations: Structs wrapping unsafe pointers to interop with C or optimize memory; map/slice element types that resolve to invalid when built with reflection at runtime; generated code holding uintptr handles.

Related errors


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

Appendix: source

Thrown at sdks/go/pkg/beam/core/typex/class.go:132

	}
	visited[t] = true

	// Handle special types.
	if t == nil ||
		t == EventTimeType ||
		t.Implements(WindowType) ||
		t == PaneInfoType ||
		t == TimersType ||
		t == BundleFinalizationType ||
		t == reflectx.Error ||
		t == reflectx.Context ||
		IsUniversal(t) {
		return errors.Errorf("Special type \"%v\" not permitted in concrete types", t)
	}

	switch t.Kind() {
	case reflect.Invalid, reflect.UnsafePointer, reflect.Uintptr:
		return errors.Errorf("Type \"%v\" of kind \"%v\" not permitted in concrete types. All types must be manageable.", t, t.Kind()) // no unmanageable types

	case reflect.Chan, reflect.Func:
		return errors.Errorf("Type \"%v\" of kind \"%v\" not permitted in concrete types. All types must be serializable.", t, t.Kind()) // no unserializable types

	case reflect.Map:
		err := isConcrete(t.Elem(), visited)
		if err == nil {
			err = isConcrete(t.Key(), visited)
		}
		if err != nil {
			err = errors.Wrapf(err, "Nested type in map \"%v\" not permitted in concrete types.", t)
		}
		return err

	case reflect.Array, reflect.Slice, reflect.Ptr:
		err := isConcrete(t.Elem(), visited)
		if err != nil {
			err = errors.Wrapf(err, "Nested type in %v \"%v\" not permitted in concrete types.", t.Kind(), t)

View on GitHub (pinned to 12126d8942)