flowable/flowable-engine · warning

Exception while executing

Error message

Exception while executing {} : {}

What it means

Logged by ScriptTaskActivityBehavior when script execution throws an ActivitiException. The script task's activity id and message are logged, then the root cause is inspected: if it is a BpmnError it is propagated to error handling, otherwise the failure continues as a normal script failure.

Solutions

  1. Read the logged root-cause message and fix the script
  2. Throw BpmnError from the script if error-boundary handling was intended
  3. Verify the script engine (e.g. groovy) dependency is present and the script compiles

Example fix

// before (script)
throw new RuntimeException("bad input");
// after (intended error handling)
throw new org.activiti.engine.delegate.BpmnError("BAD_INPUT");
Defensive patterns

Strategy: type-guard

Validate before calling

// validate script input variables exist before the script task runs
if (execution.getVariable("input") == null) throw new BpmnError("MISSING_INPUT");

Type guard

if (ExceptionUtils.getRootCause(e) instanceof BpmnError) { /* routed to boundary error */ }

Try / catch

try { scriptEngine.eval(script, bindings); } catch (ScriptException e) { throw new ActivitiException("script failed", e); }

Prevention

When it happens

Trigger: A BPMN script task whose script throws/compiles-fails (e.g. groovy/javascript engine errors, missing bindings) wrapped in an ActivitiException.

Common situations: Script syntax errors, missing script engine dependency on the classpath, scripts referencing undefined variables, intended BpmnError signaling from scripts.

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/a8a4ac522ee19925. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ScriptTaskActivityBehavior.java:86

            if (taskElementProperties != null && taskElementProperties.has(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT)) {
                String overrideScript = taskElementProperties.get(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT).asString();
                if (StringUtils.isNotEmpty(overrideScript) && !overrideScript.equals(script)) {
                    script = overrideScript;
                }
            }
        }

        boolean noErrors = true;
        try {
            Object result = scriptingEngines.evaluate(script, language, execution, storeScriptVariables);

            if (resultVariable != null) {
                execution.setVariable(resultVariable, result);
            }

        } catch (ActivitiException e) {

            LOGGER.warn("Exception while executing {} : {}", activityExecution.getActivity().getId(), e.getMessage());

            noErrors = false;
            Throwable rootCause = ExceptionUtils.getRootCause(e);
            if (rootCause instanceof BpmnError) {
                ErrorPropagation.propagateError((BpmnError) rootCause, activityExecution);
            } else {
                throw e;
            }
        }
        if (noErrors) {
            leave(activityExecution);
        }
    }

}

View on GitHub (pinned to d6d39ce1c6)