flowable/flowable-engine · error · ELException

Only '${argCount}' arguments were provided for a lambda expr

Error message

Only '${argCount}' arguments were provided for a lambda expression that requires at least '${formalParamCount}''

What it means

Arity guard in LambdaExpression.invoke: fewer arguments were passed to an EL lambda expression than it has formal parameters (lambdas are not curried beyond their declared params here), so invocation is rejected before evaluation.

Source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/javax/el/LambdaExpression.java:57

    }

    @SuppressWarnings("null") // args[i] can't be null due to earlier checks
    public Object invoke(ELContext context, Object... args) throws ELException {

        Objects.requireNonNull(context, "context is null");

        int formalParamCount = 0;
        if (formalParameters != null) {
            formalParamCount = formalParameters.size();
        }

        int argCount = 0;
        if (args != null) {
            argCount = args.length;
        }

        if (formalParamCount > argCount) {
            throw new ELException("Only '" + argCount + "' arguments were provided for a lambda expression that requires at least '" + formalParamCount + "''");
        }

        // Build the argument map
        // Start with the arguments from any outer expressions so if there is
        // any overlap the local arguments have priority
        Map<String, Object> lambdaArguments = new HashMap<>(nestedArguments);
        for (int i = 0; i < formalParamCount; i++) {
            lambdaArguments.put(formalParameters.get(i), args[i]);
        }

        context.enterLambdaScope(lambdaArguments);

        try {
            Object result = expression.getValue(context);
            // Make arguments from this expression available to any nested
            // expression
            if (result instanceof LambdaExpression) {
                ((LambdaExpression) result).nestedArguments.putAll(lambdaArguments);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass one argument per declared formal parameter of the lambda
  2. Provide defaulting logic in the expression if optional arguments are needed

Example fix

// before
expr.invoke(new Object[]{5}); // lambda declared (a,b)
// after
expr.invoke(new Object[]{5, 10});
Defensive patterns

Strategy: validation

Validate before calling

if (args == null || args.length < lambda.getFormalParamCount()) {
  throw new IllegalArgumentException("Insufficient lambda arguments");
}

Try / catch

try {
  return lambda.invoke(args);
} catch (ELException e) {
  throw new IllegalArgumentException("Lambda called with too few arguments", e);
}

Prevention

When it happens

Trigger: Calling lambdaExpression.invoke(o1) for a lambda declared with two or more parameters, or evaluating an EL lambda expression like x -> y -> x+y with insufficient arguments.

Common situations: Programmatic EL evaluation of lambdas where argument arrays are built dynamically; expression changes in config adding parameters without updating call sites.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/40377f8dd8b45e34. Report an issue: GitHub.