apache/beam · error

fn does not satisfy signature

Error message

fn does not satisfy signature %v

What it means

MustSatisfy wraps any error returned by Satisfy in a panic carrying the message 'fn does not satisfy signature %v'. It is the panicking variant used by callers (Partition, Include, Exclude, validate) that treat a signature mismatch as a programmer error rather than a recoverable condition.

Solutions

  1. Read the wrapped cause (the Satisfy error) in the panic message and fix the function's parameters/returns accordingly.
  2. Call Satisfy instead of MustSatisfy to get a recoverable error for validation.
  3. Compare the function signature against the required Signature definition for the API being used.

Example fix

// before
beam.Partition(s, 3, func(e int) int { return e % 3 }) // ok, but fn missing error return fails MustSatisfy
// after
beam.Partition(s, 3, func(e int) (int, error) { return e % 3, nil })
Defensive patterns

Strategy: try-catch

Validate before calling

if err := funcx.Satisfy(fn, sig); err != nil {
    return fmt.Errorf("registration would panic: %w", err)
}

Try / catch

defer func() {
    if r := recover(); r != nil {
        err = fmt.Errorf("MustSatisfy panic: %v", r)
    }
}()

Prevention

When it happens

Trigger: Calling MustSatisfy (directly or via beam.Partition/Include/Exclude) with any function that fails arity, generic binding, or optional matching checks - the underlying Satisfy error is wrapped and panicked.

Common situations: Using beam.Partition with a partition function of wrong arity or return count; passing a filter function to Include/Exclude with wrong input/output types; programming errors caught at pipeline-construction time.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at sdks/go/pkg/beam/core/funcx/signature.go:232

				return errors.Errorf("optional generic parameter not bound %v", t.Name())
			}
			t = subst
		}
		for i < len(models) && models[i] != t {
			i++
		}

		if i == len(models) {
			return errors.Errorf("failed to match optional parameter %v", t)
		}
	}
	return nil
}

// MustSatisfy panics if the given fn does not satisfy the signature.
func MustSatisfy(fn any, sig *Signature) {
	if err := Satisfy(fn, sig); err != nil {
		panic(errors.Wrapf(err, "fn does not satisfy signature %v", sig))
	}
}

View on GitHub (pinned to 12126d8942)