apache/beam · error

mismatched event time type in method

Error message

mismatched event time type in method %v, parameter at index %v. got: %v, want: %v.

What it means

InitialWatermarkEstimatorState's parameter at the reported index (here index 0, the first parameter after the main inputs) must be of type typex.EventTime, representing the element's timestamp. Beam validates this at graph construction and throws when the declared type differs, because it passes the element's event time in that position.

Solutions

  1. Make the event-time parameter exactly typex.EventTime in InitialWatermarkEstimatorState.
  2. Place the event-time parameter immediately before the restriction parameter (after all main-input parameters).
  3. Replace time.Time/int64 with typex.EventTime and convert inside the method if needed.
  4. Re-run the pipeline; Beam reports the offending parameter index in the message.

Example fix

// before
func (f *fn) InitialWatermarkEstimatorState(ts int64, rest MyRestriction) myState { return myState{} }
// after
func (f *fn) InitialWatermarkEstimatorState(ts typex.EventTime, rest MyRestriction) myState {
    return myState{watermark: ts}
}
Defensive patterns

Strategy: validation

Validate before calling

var _ func(string, typex.EventTime, MyRestriction) myState = (*fn).InitialWatermarkEstimatorState

Prevention

When it happens

Trigger: Declaring InitialWatermarkEstimatorState's event-time parameter with the wrong type (e.g. time.Time, int64, typex.Window) instead of typex.EventTime; placing the restriction parameter before the event-time parameter so the checked index holds the wrong type.

Common situations: Using a natural Go time type instead of Beam's typex.EventTime; reordering parameters; copying signatures from older Beam examples where ordering differed.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

Thrown at sdks/go/pkg/beam/core/graph/fn.go:1277

		case int(MainSingle), int(MainKv):
			numMainIn = paramNum
		}
	}

	for _, name := range watermarkEstimationNames {
		method := fn.methods[name]
		switch name {
		case initialWatermarkEstimatorStateName:
			if len(method.Param) != numMainIn+2 {
				err := errors.Errorf("unexpected number of params in method %v. got: %v, want: %v",
					initialWatermarkEstimatorStateName, len(method.Param), numMainIn+2)
				return errors.SetTopLevelMsgf(err, "unexpected number of parameters in method %v. "+
					"got: %v, want: %v. Check that the signature conforms to the expected signature for %v, "+
					"and that elements in SDF method parameters match elements in %v.",
					initialWatermarkEstimatorStateName, len(method.Param), numMainIn+2, initialWatermarkEstimatorStateName, processElementName)
			}
			if method.Param[0].T != typex.EventTimeType {
				err := errors.Errorf("unexpected parameter type in method %v, param %v. got: %v, want: %v",
					initialWatermarkEstimatorStateName, 0, method.Param[0].T, typex.EventTimeType)
				return errors.SetTopLevelMsgf(err, "mismatched event time type in method %v, "+
					"parameter at index %v. got: %v, want: %v.",
					initialWatermarkEstimatorStateName, 0, method.Param[0].T, typex.EventTimeType)
			}
			if method.Param[1].T != restT {
				err := errors.Errorf("mismatched restriction type in method %v, param %v. got: %v, want: %v",
					initialWatermarkEstimatorStateName, 1, method.Param[1].T, restT)
				return errors.SetTopLevelMsgf(err, "mismatched restriction type in method %v, "+
					"parameter at index %v. got: %v, want: %v (from method %v). "+
					"Ensure that all restrictions in an SDF are the same type.",
					initialWatermarkEstimatorStateName, 1, method.Param[1].T, restT, createTrackerName)
			}
			if err := validateSdfElementT(fn, initialWatermarkEstimatorStateName, method, numMainIn, 2); err != nil {
				return err
			}

			if len(method.Ret) != 1 {

View on GitHub (pinned to 12126d8942)