flowable/flowable-engine · error · FlowableException

Error while evaluating expression:

Error message

Error while evaluating expression: 

What it means

JuelExpression.getValue's catch-all wraps any non-Flowable Exception during expression evaluation in FlowableException('Error while evaluating expression: <expr> with <variableContainer>'). This is the generic evaluation-failure path: anything other than PropertyNotFoundException/MethodNotFoundException lands here (e.g. NPE inside a bean method, ClassCastException, resolver errors).

Source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JuelExpression.java:60

    }
    
    @Override
    public Object getValue(VariableContainer variableContainer) {
        ELContext elContext = expressionManager.getElContext(variableContainer);
        Object originalVariableContainer = elContext.getContext(VariableContainer.class);
        elContext.putContext(VariableContainer.class, variableContainer);
        Object originalValueContext = elContext.getContext(EvaluationState.class);
        elContext.putContext(EvaluationState.class, EvaluationState.READ);
        try {
            return resolveGetValueExpression(elContext);
        } catch (PropertyNotFoundException pnfe) {
            throw new FlowableException("Unknown property used in expression: " + expressionText + " with " + variableContainer, pnfe);
        } catch (MethodNotFoundException mnfe) {
            throw new FlowableException("Unknown method used in expression: " + expressionText + " with " + variableContainer, mnfe);
        } catch (FlowableException ex) {
            throw ex;
        } catch (Exception e) {
            throw new FlowableException("Error while evaluating expression: " + expressionText + " with " + variableContainer, e);
        } finally {
            elContext.putContext(EvaluationState.class, originalValueContext);
            elContext.putContext(VariableContainer.class, originalVariableContainer);
        }
    }

    protected Object resolveGetValueExpression(ELContext elContext) {
        return valueExpression.getValue(elContext);
    }

    @Override
    public void setValue(Object value, VariableContainer variableContainer) {
        ELContext elContext = expressionManager.getElContext(variableContainer);
        Object originalVariableContainer = elContext.getContext(VariableContainer.class);
        elContext.putContext(VariableContainer.class, variableContainer);
        Object originalValueContext = elContext.getContext(EvaluationState.class);
        elContext.putContext(EvaluationState.class, EvaluationState.WRITE);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect the cause (getCause()) to find the real exception thrown during evaluation
  2. Fix the underlying defect in the invoked bean method or expression types
  3. Harden expressions against nulls (e.g. ${var != null && var.field != null ? ... : ...}) and avoid side effects in expressions

Example fix

// before
${customer.address.city}  // NPE when address is null
// after
${customer.address != null ? customer.address.city : ''}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-evaluate guarded version: ${v != null && v.field != null ? v.field : default}

Type guard

boolean safeChain(Object o, java.util.function.Function<Object,Object> f) { return o != null && java.util.Objects.nonNull(f.apply(o)); }

Try / catch

try { value = expr.getValue(ctx); } catch (FlowableException e) { Throwable root = e.getCause(); log.error("Expression {} failed: {}", e.getMessage(), root, root); throw e; }

Prevention

When it happens

Trigger: An expression whose evaluation throws at runtime — a method invoked in the expression throws an exception, a type coercion fails, an EL resolver (like JsonNodeELResolver) throws IllegalArgumentException/PropertyNotWritableException, etc.

Common situations: Bean methods invoked from expressions throwing NPE on unset fields; invoking JsonNodeELResolver-based writes on read-only resolvers; incompatible types in arithmetic/comparison inside the expression.

Related errors


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