{"record":{"id":"031a6fa13344f1f8","repo":"flowable/flowable-engine","slug":"e-getmessage-031a6f","errorCode":null,"errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","errorType":"exception","errorClass":"FlowableScriptException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/JSR223FlowableScriptEngine.java","lineNumber":203,"sourceCode":"        }\n\n        @Override\n        public ScriptEvaluation evaluate() throws FlowableScriptException {\n            if (StringUtils.isEmpty(language)) {\n                throw new FlowableIllegalArgumentException(\"language is required\");\n            }\n\n            if (StringUtils.isEmpty(script)) {\n                throw new FlowableIllegalArgumentException(\"script is required\");\n            }\n\n            ScriptEngine scriptEngine = getEngineByName(language);\n            Bindings bindings = createBindings();\n            try {\n                Object result = scriptEngine.eval(script, bindings);\n                return new ScriptEvaluationImpl(resolver, result);\n            } catch (ScriptException e) {\n                throw new FlowableScriptException(e.getMessage(), e);\n            }\n        }\n\n        protected Bindings createBindings() {\n            return new ScriptBindings(Collections.singletonList(resolver), scopeContainer, inputVariableContainer, storeScriptVariables);\n        }\n    }\n}\n","sourceCodeStart":185,"sourceCodeEnd":212,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/JSR223FlowableScriptEngine.java#L185-L212","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Inspect the cause chain (getCause()) for the underlying ScriptException and its line/column info.","Fix the script syntax or variable references; verify variables are provided via the resolver/scope.","Reproduce the script in a standalone engine (jrunscript / Groovy console) to debug quickly.","Check the scriptTrace emitted to ScriptTraceListeners (see ScriptingEngines) for exact failure context."],"exampleFix":"// before (script references undefined variable)\nreturn oderTotal * 2;\n\n// after (match binding name)\nreturn orderTotal * 2;","handlingStrategy":"try-catch","validationCode":"// pre-validate variables used by the script exist in the scope\nfor (String var : requiredScriptVariables) {\n    if (variableContainer.getVariable(var) == null) {\n        throw new IllegalStateException(\"Script variable missing: \" + var);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    return request.evaluate();\n} catch (FlowableScriptException e) {\n    Throwable root = e.getCause(); // javax.script.ScriptException\n    log.error(\"Script evaluation failed: {} | cause: {}\", e.getMessage(), root == null ? null : root.getMessage(), e);\n    throw e;\n}","preventionTips":["Unit-test scripts standalone (Groovy console, jrunscript) before deploying them in BPMN.","Document/validate the variables a script expects against the process model.","Catch ScriptException in dev builds and log full stack with line numbers."],"tags":["scripting","script-exception","runtime"],"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"}