{"record":{"id":"22e6ae6698224738","repo":"apache/beam","slug":"inputs-parameters-must-precede-emit-function-parameters","errorCode":null,"errorMessage":"inputs parameters must precede emit function parameters","messagePattern":"inputs parameters must precede emit function parameters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/funcx/fn.go","lineNumber":539,"sourceCode":"\t\tif retState, err = nextRetState(retState, r.Kind); err != nil {\n\t\t\treturn errors.WithContextf(err, \"validating return value %d for %s\", i, u.Fn.Name())\n\t\t}\n\t}\n\treturn nil\n}\n\nvar (\n\terrContextParam                      = errors.New(\"may only have a single context.Context parameter and it must be the first parameter\")\n\terrPaneParamPrecedence               = errors.New(\"may only have a single PaneInfo parameter and it must precede the WindowParam, EventTime and main input parameter\")\n\terrWindowParamPrecedence             = errors.New(\"may only have a single Window parameter and it must precede the EventTime and main input parameter\")\n\terrEventTimeParamPrecedence          = errors.New(\"may only have a single beam.EventTime parameter and it must precede the main input parameter\")\n\terrWatermarkEstimatorParamPrecedence = errors.New(\"may only have a single sdf.WatermarkEstimator parameter and it must precede the main input parameter\")\n\terrReflectTypePrecedence             = errors.New(\"may only have a single reflect.Type parameter and it must precede the main input parameter\")\n\terrRTrackerPrecedence                = errors.New(\"may only have a single sdf.RTracker parameter and it must precede the main input parameter\")\n\terrBundleFinalizationPrecedence      = errors.New(\"may only have a single BundleFinalization parameter and it must precede the main input parameter\")\n\terrStateProviderPrecedence           = errors.New(\"may only have a single state.Provider parameter and it must precede the main input parameter\")\n\terrTimerProviderPrecedence           = errors.New(\"may only have a single timer.Provider parameter and it must precede the main input parameter\")\n\terrInputPrecedence                   = errors.New(\"inputs parameters must precede emit function parameters\")\n)\n\ntype paramState int\n\nconst (\n\tpsStart paramState = iota\n\tpsContext\n\tpsPane\n\tpsWindow\n\tpsEventTime\n\tpsWatermarkEstimator\n\tpsType\n\tpsInput\n\tpsOutput\n\tpsRTracker\n\tpsBundleFinalization\n\tpsStateProvider\n\tpsTimerProvider","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/funcx/fn.go#L521-L557","documentation":"Sentinel error errInputPrecedence from the funcx parameter-ordering state machine: an input-side parameter kind (FnValue, FnIter, or FnReIter — side inputs and iterables) appeared after the state machine had already transitioned to the output/emit phase (FnEmit). Input parameters must all precede any emit-function parameters in a DoFn signature.","triggerScenarios":"Thrown at sdks/go/pkg/beam/core/funcx/fn.go:539 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reorder the signature so all side inputs (func(T), func(*T) bool, func(*T,*U) bool, etc.) come before any emit function parameters"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}