apache/beam · error
side inputs expected in method %v
Error message
side inputs expected in method %v
What it means
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.
Source
Thrown at sdks/go/pkg/beam/core/graph/fn.go:757
// in the signature for ProcessElement, and performs validation to check that the side inputs
// match. This function should only be used to validate methods that are expected to have matching
// side inputs to ProcessElement.
func validateSideInputs(processFnInputs []funcx.FnParam, method *funcx.Fn, methodName string, numMainIn mainInputs) error {
if numMainIn == MainUnknown {
return validateSideInputsNumUnknown(processFnInputs, method, methodName)
}
numProcessIn := len(processFnInputs)
numSideIn := numProcessIn - int(numMainIn)
posMethodIn, numMethodIn, ok := method.Inputs()
// Handle cases where method has no inputs.
if !ok {
if numSideIn == 0 { // We're good, expected no side inputs.
return nil
}
// Error, missing side inputs.
err := errors.Errorf("side inputs expected in method %v", methodName)
return errors.SetTopLevelMsgf(err,
"Missing side inputs in the %v method of a DoFn. "+
"If side inputs are present in %v those side inputs must also be present in %v.",
methodName, processElementName, methodName)
}
// Error if number of side inputs doesn't match.
if numMethodIn != numSideIn {
err := errors.Errorf("number of side inputs in method %v does not match method %v: got %d, expected %d",
methodName, processElementName, numMethodIn, numSideIn)
return errors.SetTopLevelMsgf(err,
"Incorrect number of side inputs in the %v method of a DoFn. "+
"The side inputs should match those of the %v method.",
methodName, processElementName)
}
// Error if there's a type mismatch.
methodInputs := method.Param[posMethodIn : posMethodIn+numMethodIn]View on GitHub (pinned to 12126d8942)
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.
Example fix
// before
func (fn *myFn) ProcessElement(ctx context.Context, w string, side beam.V) {}
func (fn *myFn) FinishBundle() {}
// after
func (fn *myFn) ProcessElement(ctx context.Context, w string, side beam.V) {}
func (fn *myFn) FinishBundle(side beam.V) {} Defensive patterns
Strategy: validation
Validate before calling
// count side inputs at call site and ensure each input-taking DoFn method declares them: sides := len(sideInputs) // passed to beam.ParDo // ProcessElement must have 'sides' inputs after the main input
Type guard
func hasSideInputs(m reflect.Method, want int) bool { return m.Type.NumIn()-2 >= want } // adjust for receiver/ctx Try / catch
if err := pipelineBuild(); err != nil {
if strings.Contains(err.Error(), "side inputs expected") { /* fix method signature */ }
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- number of side inputs in method %v does not match method %v:
- number of side inputs in method %v does not match method %v:
- number of emits in method %v does not match method %v: got %
- emit parameter in method %v does not match emit parameter in
- side input in method %v does not match side input in %v
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/ab06ef359baeb879.
Report an issue: GitHub.