flowable/flowable-engine · error · org.activiti.engine.ActivitiException

problem evaluating script

Error message

problem evaluating script: ${e.getMessage()}

What it means

ScriptingEngines.evaluate executes a script with the engine resolved for the given language via scriptEngine.eval. Any ScriptException (syntax errors, runtime script errors, engine failures) is wrapped and rethrown as ActivitiException with the original message plus the cause.

Solutions

  1. Read the wrapped cause (getCause()) and the embedded message to find the actual script line/error.
  2. Test the script standalone in the same language and engine version used by the process engine.
  3. Verify all variables used in the script exist in the execution/bindings scope at that point.
  4. Confirm the language's engine jar (e.g. groovy-all, nashorn for JS on newer JDKs) is on the classpath and compatible with the JDK version.

Example fix

// before
<flowable:executionListener event="start" expression="${summy.groovy}" /> // typo'd script var x = y +;
// after
<flowable:executionListener event="start">
  <flowable:script language="groovy">def x = 1 + 2
return x</flowable:script>
</flowable:executionListener>
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-validate script compiles with the same engine
ScriptEngine engine = new ScriptEngineManager().getEngineByName(language);
if (engine == null) throw new IllegalStateException("no script engine for " + language);
engine.eval(script, new SimpleBindings()); // throws early if syntax broken

Try / catch

try {
    return scriptingEngines.evaluate(script, language, bindings);
} catch (ActivitiException e) {
    logger.error("script eval failed: {} cause: {}", e.getMessage(), e.getCause(), e);
    throw e;
}

Prevention

When it happens

Trigger: Calling evaluate(script, language, bindings) (directly or via script task / condition / listener) where scriptEngine.eval throws a ScriptException — script syntax error, undefined variable access, script engine runtime failure, or unsupported language causing a bad engine invocation.

Common situations: Groovy/JS scripts with typos, referencing variables not present in the bindings/variable scope, script engine missing from classpath (no Groovy dependency) so resolution or eval fails, incompatible script syntax after switching language attribute, restricted environment blocking script compilation.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/scripting/ScriptingEngines.java:89

    public Object evaluate(String script, String language, VariableScope variableScope, boolean storeScriptVariables) {
        return evaluate(script, language, createBindings(variableScope, storeScriptVariables));
    }

    public void setCacheScriptingEngines(boolean cacheScriptingEngines) {
        this.cacheScriptingEngines = cacheScriptingEngines;
    }

    public boolean isCacheScriptingEngines() {
        return cacheScriptingEngines;
    }

    protected Object evaluate(String script, String language, Bindings bindings) {
        ScriptEngine scriptEngine = getEngineByName(language);
        try {
            return scriptEngine.eval(script, bindings);
        } catch (ScriptException e) {
            throw new ActivitiException("problem evaluating script: " + e.getMessage(), e);
        }
    }

    protected ScriptEngine getEngineByName(String language) {
        ScriptEngine scriptEngine = null;

        if (cacheScriptingEngines) {
            scriptEngine = cachedEngines.get(language);
            if (scriptEngine == null) {
                scriptEngine = scriptEngineManager.getEngineByName(language);

                if (scriptEngine != null) {
                    // ACT-1858: Special handling for groovy engine regarding GC
                    if (GROOVY_SCRIPTING_LANGUAGE.equals(language)) {
                        try {
                            scriptEngine.getContext().setAttribute("#jsr223.groovy.engine.keep.globals", "weak", ScriptContext.ENGINE_SCOPE);
                        } catch (Exception ignore) {
                            // ignore this, in case engine doesn't support the passed attribute

View on GitHub (pinned to d6d39ce1c6)