apache/beam · error

failed to create keyed iterable, got

Error message

failed to create keyed iterable, got %v

What it means

After validating the key argument, multiMapValue.invoke calls SideInputAdapter.NewKeyedIterable to materialize the iterable for that key from the side input state reader. If that adapter call returns an error, the library panics because there is no way to propagate an error through the reflect-made function. The wrapped message includes the underlying cause.

Solutions

  1. Read the wrapped cause in the panic message — fix the underlying NewKeyedIterable error first.
  2. Verify the side input PCollection was actually produced (check upstream stage logs for failures).
  3. Confirm the key passed to the multimap matches the side input's key type.
  4. Check windowing: ensure the query window matches how the side input was materialized.
  5. Enable runner/SDK side-input logging to see state read failures.
Defensive patterns

Strategy: try-catch

Try / catch

defer func() {
	if r := recover(); r != nil {
		if s, ok := r.(string); ok && strings.HasPrefix(s, "failed to create keyed iterable") {
			log.Fatalf("multimap side input read failed: %s", s)
		}
		panic(r)
	}
}()

Prevention

When it happens

Trigger: Reading a keyed iterable for a multimap side input fails — the StateReader cannot fetch the side input data (missing/failed side input materialization, runner-side state read error, wrong window), or the adapter rejects the key's type.

Common situations: Side input not materialized because the producing stage failed or was skipped; key type not comparable/encodable for the state cache; runner removed or truncated side input data; window mismatch so the requested window has no data.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

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

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

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

func (v *multiMapValue) invoke(args []reflect.Value) []reflect.Value {
	if len(args) != 1 {
		panic(fmt.Sprintf("wanted one key value, got %v", args))
	}
	rs, err := v.adapter.NewKeyedIterable(v.ctx, v.reader, v.w, args[0].Interface())
	if err != nil {
		panic(fmt.Sprintf("failed to create keyed iterable, got %v", err))
	}
	iter := makeIter(v.t.Out(0), rs)
	iter.Init()
	return []reflect.Value{reflect.ValueOf(iter.Value())}
}

View on GitHub (pinned to 12126d8942)