apache/beam · error
InitialWatermarkEstimatorState fn %v has unexpected number o
Error message
InitialWatermarkEstimatorState fn %v has unexpected number of parameters: %v
What it means
The InitialWatermarkEstimatorState function of an SDF must match a supported signature; the reflection invoker only implements specific arities. If the function has an unsupported number of parameters, initCallFn returns this error during invoker construction (newCreateWatermarkEstimatorInvoker setup).
Source
Thrown at sdks/go/pkg/beam/core/runtime/exec/sdf_invokers.go:455
default:
switch len(n.fn.Param) {
case 3:
n.call = func(rest any, elms *FullValue) any {
n.args[0] = elms.Timestamp
n.args[1] = rest
n.args[2] = elms.Elm
return n.fn.Fn.Call(n.args)[0]
}
case 4:
n.call = func(rest any, elms *FullValue) any {
n.args[0] = elms.Timestamp
n.args[1] = rest
n.args[2] = elms.Elm
n.args[3] = elms.Elm2
return n.fn.Fn.Call(n.args)[0]
}
default:
return errors.Errorf("InitialWatermarkEstimatorState fn %v has unexpected number of parameters: %v",
n.fn.Fn.Name(), len(n.fn.Param))
}
}
return nil
}
// Invoke calls InitialWatermarkEstimatorState given a restriction and returns an sdf.RTracker.
func (n *iwesInvoker) Invoke(rest any, elms *FullValue) any {
return n.call(rest, elms)
}
// Reset zeroes argument entries in the cached slice to allow values to be
// garbage collected after the bundle ends.
func (n *iwesInvoker) Reset() {
for i := range n.args {
n.args[i] = nil
}
}View on GitHub (pinned to 12126d8942)
Solutions
- Match InitialWatermarkEstimatorState to a supported signature such as func(wstate W, ts typex.EventTime, rest R, el T) W or its smaller arities.
- Remove extra parameters not part of the documented signature set.
- Pass auxiliary configuration via the DoFn struct fields instead of extra function parameters.
- Compare against the sdf package docs/examples for InitialWatermarkEstimatorState.
Example fix
// before
func (fn *mySdf) InitialWatermarkEstimatorState(ctx context.Context, wstate W, ts typex.EventTime) W { ... }
// after
func (fn *mySdf) InitialWatermarkEstimatorState(wstate W, ts typex.EventTime) W { ... } Defensive patterns
Strategy: validation
Validate before calling
t := reflect.TypeOf(fn.InitialWatermarkEstimatorState)
if t.NumIn() > 4 {
return fmt.Errorf("InitialWatermarkEstimatorState has unsupported arity %d", t.NumIn())
} Try / catch
if err != nil {
if strings.Contains(err.Error(), "InitialWatermarkEstimatorState fn") {
// align the signature with a supported form
}
return err
} Prevention
- Copy signatures verbatim from sdf package examples.
- Avoid adding context/config parameters to SDF watermark hooks.
- Validate DoFn signatures in tests before deployment.
When it happens
Trigger: Registering an InitialWatermarkEstimatorState fn with a signature outside the supported forms, e.g. taking 3+ parameters or an odd combination of watermark state, timestamp, element, and restriction. The supported call paths pass at most (state, ts, elms...) and the default case errors at sdf_invokers.go:455.
Common situations: Developers adding an extra context or config parameter to InitialWatermarkEstimatorState, or mixing up the ordering so the reflected signature no longer matches any generated case.
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
- CreateWatermarkEstimator fn %v has unexpected number of para
- WatermarkEstimatorState fn %v has unexpected number of param
- CreateInitialRestriction has unexpected number of parameters
- SplitRestriction has unexpected number of parameters: %v
- RestrictionSize has unexpected number of parameters: %v
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/34acbf3bdd603db1.
Report an issue: GitHub.