{"record":{"id":"2a78d9c7156d7e0b","repo":"flowable/flowable-engine","slug":"script-is-required","errorCode":null,"errorMessage":"script is required","messagePattern":"script is required","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/JSR223FlowableScriptEngine.java","lineNumber":194,"sourceCode":"        public FlowableScriptEvaluationRequest inputVariableContainer(VariableContainer inputVariableContainer) {\n            this.inputVariableContainer = inputVariableContainer;\n            return this;\n        }\n\n        @Override\n        public FlowableScriptEvaluationRequest storeScriptVariables() {\n            this.storeScriptVariables = true;\n            return this;\n        }\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":176,"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#L176-L212","documentation":"FlowableScriptEvaluationRequest.evaluate() re-validates the request before executing: if the script field was never set (null or empty) it throws FlowableIllegalArgumentException('script is required'). This is the evaluate-time counterpart of the builder-time 'script is empty' check.","triggerScenarios":"Building a FlowableScriptEvaluationRequest without calling script(...) and invoking evaluate(); or the script text was set from a source that returned null/empty after the builder check path was bypassed.","commonSituations":"Programmatic script evaluation with conditionally omitted script body; process variables/expressions expected to supply the script content but resolving to empty.","solutions":["Always call script(<code>) with non-empty script text before evaluate().","Validate the script source (variable, file, template) before constructing the request.","Fail early with a domain-specific message when the script source is blank."],"exampleFix":"// before\nvar req = new FlowableScriptEvaluationRequest().language(\"groovy\");\nreq.evaluate();\n\n// after\nvar req = new FlowableScriptEvaluationRequest()\n    .language(\"groovy\")\n    .script(\"return x * 2\");\nreq.evaluate();","handlingStrategy":"validation","validationCode":"if (script == null || script.trim().isEmpty()) {\n    throw new IllegalStateException(\"Cannot evaluate script: script was never set on the request\");\n}","typeGuard":"boolean isEvaluableRequest(FlowableScriptEvaluationRequest r) { return r != null && r.getScript() != null && !r.getScript().isEmpty(); }","tryCatchPattern":"try {\n    return request.evaluate();\n} catch (FlowableIllegalArgumentException e) {\n    throw new IllegalStateException(\"Script request incomplete: \" + e.getMessage(), e);\n}","preventionTips":["Resolve script content from variables/templates before building the request.","Use a factory method that requires (language, script) pairs.","Fail at template/resource load time if the resolved script is blank."],"tags":["scripting","validation","builder"],"backgroundTag":"missing-required-argument","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"}