{"record":{"id":"e11232b5702f055e","repo":"flowable/flowable-engine","slug":"the-field-script-should-be-set-on-getclass","errorCode":null,"errorMessage":"The field 'script' should be set on \" + getClass().getSimpleName()","messagePattern":"The field 'script' should be set on \" \\+ getClass\\(\\)\\.getSimpleName\\(\\)","errorType":"exception","errorClass":"FlowableIllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/AbstractScriptEvaluator.java","lineNumber":99,"sourceCode":"        Object result = evaluateScript(getScriptingEngines(), request);\n\n        if (resultVariable != null) {\n            VariableContainer variableContainer = request.getScopeContainer();\n            String resultVariable = Objects.toString(this.resultVariable.getValue(variableContainer), null);\n            if (variableContainer != null && resultVariable != null) {\n                variableContainer.setVariable(resultVariable, result);\n            }\n        }\n        return result;\n    }\n\n    protected Object evaluateScript(ScriptingEngines scriptingEngines, ScriptEngineRequest request) {\n        return scriptingEngines.evaluate(request).getResult();\n    }\n\n    protected void validateParameters() {\n        if (script == null) {\n            throw new FlowableIllegalStateException(\"The field 'script' should be set on \" + getClass().getSimpleName());\n        }\n\n        if (language == null) {\n            throw new FlowableIllegalStateException(\"The field 'language' should be set on \" + getClass().getSimpleName());\n        }\n    }\n\n    protected abstract ScriptingEngines getScriptingEngines();\n\n    public void setScript(String script) {\n        this.script = script;\n    }\n\n    /**\n     * Sets the script as Expression for backwards compatibility.\n     * Requires to for 'field' injection of scripts.\n     * Expression is not evaluated\n     */","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/AbstractScriptEvaluator.java#L81-L117","documentation":"Parameter guard in AbstractScriptEvaluator.validateParameters: the script source expression resolves to null/empty, so there is no code for the script engine to evaluate; the guard fires before engine selection with the evaluator class name in the message.","triggerScenarios":"Programmatically creating an AbstractScriptEvaluator subclass (or binding one via BPMN) without calling setScript(...), then invoking createScriptRequest()/evaluate.","commonSituations":"Custom JavaDelegate/listener wired in Spring without injecting the script property; BPMN XML missing the script body; refactoring removed setScript initialization.","solutions":["Set a non-empty 'script' field on the script task/listener configuration","Verify the script text or expression resolves against the available variables"],"exampleFix":"// before\nGroovyScriptEvaluator eval = new GroovyScriptEvaluator();\neval.setLanguage(\"groovy\");\n// after\nGroovyScriptEvaluator eval = new GroovyScriptEvaluator();\neval.setLanguage(\"groovy\");\neval.setScript(\"return input * 2;\");","handlingStrategy":"validation","validationCode":"if (evaluator.getScript() == null) {\n    throw new IllegalStateException(\"script property not injected on \" + evaluator.getClass().getSimpleName());\n}","typeGuard":null,"tryCatchPattern":"try {\n    return evaluator.createScriptRequest(variableContainer).build();\n} catch (FlowableIllegalStateException e) {\n    if (e.getMessage().contains(\"field 'script'\")) {\n        throw new IllegalStateException(\"Configure the script property on \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Call setScript(...) at construction/bean init time","Add startup validation that all evaluator properties are set","Check BPMN XML contains a script body"],"tags":["scripting","listener","missing-property"],"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"}