apache/beam · error

key of cannot bind to

Error message

key of %v cannot bind to %v

What it means

Error returned by tryBindInbound when binding a KV-typed main input: the first component (the key) of the collection type cannot bind to the DoFn's first parameter because that parameter is not of kind funcx.FnValue. For a main KV input both key and value parameters must be plain values, so a mismatched key parameter aborts binding.

Solutions

  1. Adjust the DoFn signature so the first (key) parameter is a plain value type matching the KV key
  2. Or convert the input PCollection so its type matches the DoFn parameters
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sdks/go/pkg/beam/core/graph/bind.go:229 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at sdks/go/pkg/beam/core/graph/bind.go:229

					return nil, kind, errors.Errorf("%v cannot bind to %v", t, args[0])
				}

				kind = ReIter
				other = typex.New(trimmed[0])

			case funcx.FnMultiMap:
				return nil, kind, errors.Errorf("input to MultiMap side input must be KV, got %v", t)

			default:
				return nil, kind, errors.Errorf("unexpected param kind: %v", arg)
			}
		}
	case typex.Composite:
		switch t.Type() {
		case typex.KVType:
			if isMain {
				if args[0].Kind != funcx.FnValue {
					return nil, kind, errors.Errorf("key of %v cannot bind to %v", t, args[0])
				}
				if args[1].Kind != funcx.FnValue {
					return nil, kind, errors.Errorf("value of %v cannot bind to %v", t, args[1])
				}
				other = typex.NewKV(typex.New(args[0].T), typex.New(args[1].T))
			} else {
				switch args[0].Kind {
				case funcx.FnIter:
					values, _ := funcx.UnfoldIter(args[0].T)
					trimmed := trimIllegal(values)
					if len(trimmed) != 2 {
						return nil, kind, errors.Errorf("%v cannot bind to %v", t, args[0])
					}

					kind = Iter
					other = typex.NewKV(typex.New(trimmed[0]), typex.New(trimmed[1]))

				case funcx.FnReIter:

View on GitHub (pinned to 12126d8942)