flowable/flowable-engine · error · FlowableScriptException

e.getMessage()

Error message

e.getMessage()

What it means

When scriptEngine.eval(script, bindings) throws a javax.script.ScriptException, evaluate() wraps it into FlowableScriptException using the exception's message. This is a wrapper, so the root cause is any script execution failure: syntax error, undefined variable, missing engine function, etc. The original ScriptException is preserved as the cause.

Solutions

  1. Inspect the cause chain (getCause()) for the underlying ScriptException and its line/column info.
  2. Fix the script syntax or variable references; verify variables are provided via the resolver/scope.
  3. Reproduce the script in a standalone engine (jrunscript / Groovy console) to debug quickly.
  4. Check the scriptTrace emitted to ScriptTraceListeners (see ScriptingEngines) for exact failure context.

Example fix

// before (script references undefined variable)
return oderTotal * 2;

// after (match binding name)
return orderTotal * 2;
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-validate variables used by the script exist in the scope
for (String var : requiredScriptVariables) {
    if (variableContainer.getVariable(var) == null) {
        throw new IllegalStateException("Script variable missing: " + var);
    }
}

Try / catch

try {
    return request.evaluate();
} catch (FlowableScriptException e) {
    Throwable root = e.getCause(); // javax.script.ScriptException
    log.error("Script evaluation failed: {} | cause: {}", e.getMessage(), root == null ? null : root.getMessage(), e);
    throw e;
}

Prevention

When it happens

Trigger: Any runtime or compile-time failure inside the evaluated script: syntax errors, references to variables not present in the bindings, exceptions thrown from script code, engine-specific limits.

Common situations: Groovy/JS script referencing a variable that is not a process variable nor in the variable scope; script not adapted after a process-model rename; JDK/ engine version change breaking script syntax (e.g. Nashorn ES6 syntax).

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/JSR223FlowableScriptEngine.java:203

        }

        @Override
        public ScriptEvaluation evaluate() throws FlowableScriptException {
            if (StringUtils.isEmpty(language)) {
                throw new FlowableIllegalArgumentException("language is required");
            }

            if (StringUtils.isEmpty(script)) {
                throw new FlowableIllegalArgumentException("script is required");
            }

            ScriptEngine scriptEngine = getEngineByName(language);
            Bindings bindings = createBindings();
            try {
                Object result = scriptEngine.eval(script, bindings);
                return new ScriptEvaluationImpl(resolver, result);
            } catch (ScriptException e) {
                throw new FlowableScriptException(e.getMessage(), e);
            }
        }

        protected Bindings createBindings() {
            return new ScriptBindings(Collections.singletonList(resolver), scopeContainer, inputVariableContainer, storeScriptVariables);
        }
    }
}

View on GitHub (pinned to d6d39ce1c6)