{"record":{"id":"746b34b1244c77f8","repo":"apache/beam","slug":"mismatched-event-time-type-in-method-v-parameter-at-index-v","errorCode":null,"errorMessage":"mismatched event time type in method %v, parameter at index %v. got: %v, want: %v.","messagePattern":"mismatched event time type in method (.+?), parameter at index (.+?)\\. got: (.+?), want: (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/fn.go","lineNumber":1277,"sourceCode":"\t\tcase int(MainSingle), int(MainKv):\n\t\t\tnumMainIn = paramNum\n\t\t}\n\t}\n\n\tfor _, name := range watermarkEstimationNames {\n\t\tmethod := fn.methods[name]\n\t\tswitch name {\n\t\tcase initialWatermarkEstimatorStateName:\n\t\t\tif len(method.Param) != numMainIn+2 {\n\t\t\t\terr := errors.Errorf(\"unexpected number of params in method %v. got: %v, want: %v\",\n\t\t\t\t\tinitialWatermarkEstimatorStateName, len(method.Param), numMainIn+2)\n\t\t\t\treturn errors.SetTopLevelMsgf(err, \"unexpected number of parameters in method %v. \"+\n\t\t\t\t\t\"got: %v, want: %v. Check that the signature conforms to the expected signature for %v, \"+\n\t\t\t\t\t\"and that elements in SDF method parameters match elements in %v.\",\n\t\t\t\t\tinitialWatermarkEstimatorStateName, len(method.Param), numMainIn+2, initialWatermarkEstimatorStateName, processElementName)\n\t\t\t}\n\t\t\tif method.Param[0].T != typex.EventTimeType {\n\t\t\t\terr := errors.Errorf(\"unexpected parameter type in method %v, param %v. got: %v, want: %v\",\n\t\t\t\t\tinitialWatermarkEstimatorStateName, 0, method.Param[0].T, typex.EventTimeType)\n\t\t\t\treturn errors.SetTopLevelMsgf(err, \"mismatched event time type in method %v, \"+\n\t\t\t\t\t\"parameter at index %v. got: %v, want: %v.\",\n\t\t\t\t\tinitialWatermarkEstimatorStateName, 0, method.Param[0].T, typex.EventTimeType)\n\t\t\t}\n\t\t\tif method.Param[1].T != restT {\n\t\t\t\terr := errors.Errorf(\"mismatched restriction type in method %v, param %v. got: %v, want: %v\",\n\t\t\t\t\tinitialWatermarkEstimatorStateName, 1, method.Param[1].T, restT)\n\t\t\t\treturn errors.SetTopLevelMsgf(err, \"mismatched restriction type in method %v, \"+\n\t\t\t\t\t\"parameter at index %v. got: %v, want: %v (from method %v). \"+\n\t\t\t\t\t\"Ensure that all restrictions in an SDF are the same type.\",\n\t\t\t\t\tinitialWatermarkEstimatorStateName, 1, method.Param[1].T, restT, createTrackerName)\n\t\t\t}\n\t\t\tif err := validateSdfElementT(fn, initialWatermarkEstimatorStateName, method, numMainIn, 2); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif len(method.Ret) != 1 {","sourceCodeStart":1259,"sourceCodeEnd":1295,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/fn.go#L1259-L1295","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using a natural Go time type instead of Beam's typex.EventTime; reordering parameters; copying signatures from older Beam examples where ordering differed.","solutions":["Make the event-time parameter exactly typex.EventTime in InitialWatermarkEstimatorState.","Place the event-time parameter immediately before the restriction parameter (after all main-input parameters).","Replace time.Time/int64 with typex.EventTime and convert inside the method if needed.","Re-run the pipeline; Beam reports the offending parameter index in the message."],"exampleFix":"// before\nfunc (f *fn) InitialWatermarkEstimatorState(ts int64, rest MyRestriction) myState { return myState{} }\n// after\nfunc (f *fn) InitialWatermarkEstimatorState(ts typex.EventTime, rest MyRestriction) myState {\n    return myState{watermark: ts}\n}","handlingStrategy":"validation","validationCode":"var _ func(string, typex.EventTime, MyRestriction) myState = (*fn).InitialWatermarkEstimatorState","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use typex.EventTime for timestamps in SDF signatures, never time.Time or int64.","Keep the order: main inputs, event time, restriction.","Compile-time function-signature assertions catch ordering and type drift."],"tags":["go","apache-beam","sdf","watermark-estimator","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}