{"record":{"id":"ab06ef359baeb879","repo":"apache/beam","slug":"side-inputs-expected-in-method-v","errorCode":null,"errorMessage":"side inputs expected in method %v","messagePattern":"side inputs expected in method (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/fn.go","lineNumber":757,"sourceCode":"// in the signature for ProcessElement, and performs validation to check that the side inputs\n// match. This function should only be used to validate methods that are expected to have matching\n// side inputs to ProcessElement.\nfunc validateSideInputs(processFnInputs []funcx.FnParam, method *funcx.Fn, methodName string, numMainIn mainInputs) error {\n\tif numMainIn == MainUnknown {\n\t\treturn validateSideInputsNumUnknown(processFnInputs, method, methodName)\n\t}\n\n\tnumProcessIn := len(processFnInputs)\n\tnumSideIn := numProcessIn - int(numMainIn)\n\tposMethodIn, numMethodIn, ok := method.Inputs()\n\n\t// Handle cases where method has no inputs.\n\tif !ok {\n\t\tif numSideIn == 0 { // We're good, expected no side inputs.\n\t\t\treturn nil\n\t\t}\n\t\t// Error, missing side inputs.\n\t\terr := errors.Errorf(\"side inputs expected in method %v\", methodName)\n\t\treturn errors.SetTopLevelMsgf(err,\n\t\t\t\"Missing side inputs in the %v method of a DoFn. \"+\n\t\t\t\t\"If side inputs are present in %v those side inputs must also be present in %v.\",\n\t\t\tmethodName, processElementName, methodName)\n\t}\n\n\t// Error if number of side inputs doesn't match.\n\tif numMethodIn != numSideIn {\n\t\terr := errors.Errorf(\"number of side inputs in method %v does not match method %v: got %d, expected %d\",\n\t\t\tmethodName, processElementName, numMethodIn, numSideIn)\n\t\treturn errors.SetTopLevelMsgf(err,\n\t\t\t\"Incorrect number of side inputs in the %v method of a DoFn. \"+\n\t\t\t\t\"The side inputs should match those of the %v method.\",\n\t\t\tmethodName, processElementName)\n\t}\n\n\t// Error if there's a type mismatch.\n\tmethodInputs := method.Param[posMethodIn : posMethodIn+numMethodIn]","sourceCodeStart":739,"sourceCodeEnd":775,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/fn.go#L739-L775","documentation":"If a DoFn auxiliary method accepts no inputs at all, but the ProcessElement method declares side inputs, validateSideInputs reports that side inputs are expected in the auxiliary method. Beam requires every method with side inputs to mirror them across all DoFn methods that take inputs.","triggerScenarios":"Calling beam.ParDo with side inputs (beam.SideInput from beam.Input(...)) on a DoFn whose StartBundle/FinishBundle/Setup/Teardown method has zero input parameters while ProcessElement has side inputs after the main input.","commonSituations":"Adding a side input to a pipeline transform without updating the DoFn's other methods; defining Setup/Teardown with no parameters after side inputs were added to ProcessElement; copying a DoFn from a non-side-input example and adding side inputs at the call site.","solutions":["Add the side input parameters to the auxiliary method, matching ProcessElement's side input list.","Alternatively, if the auxiliary method doesn't need side inputs and none are required, remove the side inputs from the beam.ParDo call.","Keep side input count and order identical to ProcessElement's side inputs."],"exampleFix":"// before\nfunc (fn *myFn) ProcessElement(ctx context.Context, w string, side beam.V) {}\nfunc (fn *myFn) FinishBundle() {}\n\n// after\nfunc (fn *myFn) ProcessElement(ctx context.Context, w string, side beam.V) {}\nfunc (fn *myFn) FinishBundle(side beam.V) {}","handlingStrategy":"validation","validationCode":"// count side inputs at call site and ensure each input-taking DoFn method declares them:\nsides := len(sideInputs) // passed to beam.ParDo\n// ProcessElement must have 'sides' inputs after the main input","typeGuard":"func hasSideInputs(m reflect.Method, want int) bool { return m.Type.NumIn()-2 >= want } // adjust for receiver/ctx","tryCatchPattern":"if err := pipelineBuild(); err != nil {\n\tif strings.Contains(err.Error(), \"side inputs expected\") { /* fix method signature */ }\n}","preventionTips":["Add side input parameters to every DoFn method that takes inputs when you add a side input to ParDo","Use the beam.SideInput helpers consistently and document side inputs next to the DoFn","Test DoFn registration with beam.ParDo in a unit test before running the pipeline"],"tags":["go","apache-beam","dofn","side-input","signature-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}