apache/beam · error

illegal re-iter type: %v

Error message

illegal re-iter type: %v

What it means

makeReIter wraps a ReStream as a reflection function value only when the target type is a valid 're-iterable' function type (func(*func) bool style recognized by funcx.IsReIter). If the expected type isn't such a re-iterator, the wrapping is impossible and it panics with the offending type.

Source

Thrown at sdks/go/pkg/beam/core/runtime/exec/input.go:73

	defer inputsMu.Unlock()
	inputs[t] = maker
}

// IsInputRegistered returns whether an input maker has already been registered.
func IsInputRegistered(t reflect.Type) bool {
	_, exists := inputs[t]
	return exists
}

type reIterValue struct {
	t  reflect.Type
	s  ReStream
	fn any
}

func makeReIter(t reflect.Type, s ReStream) ReusableInput {
	if !funcx.IsReIter(t) {
		panic(fmt.Sprintf("illegal re-iter type: %v", t))
	}

	ret := &reIterValue{t: t, s: s}
	ret.fn = reflect.MakeFunc(t, ret.invoke).Interface()
	return ret
}

func (v *reIterValue) Init() error {
	return nil
}

func (v *reIterValue) Value() any {
	return v.fn
}

func (v *reIterValue) Reset() error {
	return nil
}

View on GitHub (pinned to 12126d8942)

Solutions

  1. Fix the side input type so it is a valid re-iterable function type (e.g. func(*func) bool variants funcx recognizes).
  2. Verify the DoFn's side-input parameter type matches the actual side input kind (iter vs reiter vs slice).
  3. If you control construction, validate with funcx.IsReIter before calling makeReIter and raise a descriptive error.

Example fix

// before
in := makeReIter(badType, stream) // panics: illegal re-iter type
// after
if !funcx.IsReIter(badType) {
	return nil, fmt.Errorf("unsupported side input type %v", badType)
}
in := makeReIter(badType, stream)
Defensive patterns

Strategy: type-guard

Validate before calling

if !funcx.IsReIter(t) {
	return fmt.Errorf("side input type %v is not a valid re-iterator", t)
}

Type guard

func usableReIter(t reflect.Type) bool { return funcx.IsReIter(t) }

Prevention

When it happens

Trigger: makeSideInput building a side-input value whose declared function type t fails funcx.IsReIter — e.g. the side input type doesn't match a ReStream-backed re-iterable signature.

Common situations: Mismatch between the side input's declared coder/type in the pipeline graph and what makeSideInput expects; hand-constructed pipeline graphs or version-skew between graph construction and execution code.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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