{"record":{"id":"a8a4ac522ee19925","repo":"flowable/flowable-engine","slug":"exception-while-executing","errorCode":null,"errorMessage":"Exception while executing {} : {}","messagePattern":"Exception while executing (.+?) : (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ScriptTaskActivityBehavior.java","lineNumber":86,"sourceCode":"            if (taskElementProperties != null && taskElementProperties.has(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT)) {\n                String overrideScript = taskElementProperties.get(DynamicBpmnConstants.SCRIPT_TASK_SCRIPT).asString();\n                if (StringUtils.isNotEmpty(overrideScript) && !overrideScript.equals(script)) {\n                    script = overrideScript;\n                }\n            }\n        }\n\n        boolean noErrors = true;\n        try {\n            Object result = scriptingEngines.evaluate(script, language, execution, storeScriptVariables);\n\n            if (resultVariable != null) {\n                execution.setVariable(resultVariable, result);\n            }\n\n        } catch (ActivitiException e) {\n\n            LOGGER.warn(\"Exception while executing {} : {}\", activityExecution.getActivity().getId(), e.getMessage());\n\n            noErrors = false;\n            Throwable rootCause = ExceptionUtils.getRootCause(e);\n            if (rootCause instanceof BpmnError) {\n                ErrorPropagation.propagateError((BpmnError) rootCause, activityExecution);\n            } else {\n                throw e;\n            }\n        }\n        if (noErrors) {\n            leave(activityExecution);\n        }\n    }\n\n}\n","sourceCodeStart":68,"sourceCodeEnd":102,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ScriptTaskActivityBehavior.java#L68-L102","documentation":"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.","triggerScenarios":"A BPMN script task whose script throws/compiles-fails (e.g. groovy/javascript engine errors, missing bindings) wrapped in an ActivitiException.","commonSituations":"Script syntax errors, missing script engine dependency on the classpath, scripts referencing undefined variables, intended BpmnError signaling from scripts.","solutions":["Read the logged root-cause message and fix the script","Throw BpmnError from the script if error-boundary handling was intended","Verify the script engine (e.g. groovy) dependency is present and the script compiles"],"exampleFix":"// before (script)\nthrow new RuntimeException(\"bad input\");\n// after (intended error handling)\nthrow new org.activiti.engine.delegate.BpmnError(\"BAD_INPUT\");","handlingStrategy":"type-guard","validationCode":"// validate script input variables exist before the script task runs\nif (execution.getVariable(\"input\") == null) throw new BpmnError(\"MISSING_INPUT\");","typeGuard":"if (ExceptionUtils.getRootCause(e) instanceof BpmnError) { /* routed to boundary error */ }","tryCatchPattern":"try { scriptEngine.eval(script, bindings); } catch (ScriptException e) { throw new ActivitiException(\"script failed\", e); }","preventionTips":["Unit-test scripts with the same engine used at runtime","Include the script engine dependency (e.g. groovy) in the deployment artifact","Throw BpmnError deliberately when boundary error handling is intended"],"tags":["script-task","bpmn","error-propagation"],"backgroundTag":"invalid-argument-value","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}