{"record":{"id":"f42b5c4405d4cc49","repo":"flowable/flowable-engine","slug":"the-field-language-should-be-set-on-the-executio","errorCode":null,"errorMessage":"The field 'language' should be set on the ExecutionListener","messagePattern":"The field 'language' should be set on the ExecutionListener","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/listener/ScriptExecutionListener.java","lineNumber":40,"sourceCode":"public class ScriptExecutionListener implements ExecutionListener {\n\n    private static final long serialVersionUID = 1L;\n\n    private Expression script;\n\n    private Expression language;\n\n    private Expression resultVariable;\n\n    @Override\n    public void notify(DelegateExecution execution) {\n\n        if (script == null) {\n            throw new IllegalArgumentException(\"The field 'script' should be set on the ExecutionListener\");\n        }\n\n        if (language == null) {\n            throw new IllegalArgumentException(\"The field 'language' should be set on the ExecutionListener\");\n        }\n\n        ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();\n\n        Object result = scriptingEngines.evaluate(script.getExpressionText(), language.getExpressionText(), execution);\n\n        if (resultVariable != null) {\n            execution.setVariable(resultVariable.getExpressionText(), result);\n        }\n    }\n\n    public void setScript(Expression script) {\n        this.script = script;\n    }\n\n    public void setLanguage(Expression language) {\n        this.language = language;\n    }","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/listener/ScriptExecutionListener.java#L22-L58","documentation":"Thrown as a plain IllegalArgumentException from ScriptExecutionListener.notify when the listener's 'language' field (an Expression set via <activiti:field name=\"language\">) is null. The scripting engine needs a language name (e.g. javascript, groovy) to select a ScriptEngine for evaluating the script.","triggerScenarios":"A ScriptExecutionListener is declared with a script field but without the <activiti:field name=\"language\"> element, or the field injects a null Expression.","commonSituations":"Forgetting the language field when writing the listener XML; misspelling the field name; programmatically building the listener without setLanguage; templates/copy-paste where language was omitted.","solutions":["Add the language field: <activiti:field name=\"language\" value=\"groovy\"/>.","Verify the language value matches a ScriptEngine available to the JVM (e.g. javascript, groovy, jython).","If configuring programmatically, call setLanguage(expression) with a non-null Expression.","Keep a project template/snippet for ScriptExecutionListener that always includes both script and language fields."],"exampleFix":"// before\n<activiti:executionListener event=\"start\" class=\"...ScriptExecutionListener\">\n  <activiti:field name=\"script\"><activiti:string>execution.setVariable('x', 1);</activiti:string></activiti:field>\n</activiti:executionListener>\n\n// after\n<activiti:executionListener event=\"start\" class=\"...ScriptExecutionListener\">\n  <activiti:field name=\"script\"><activiti:string>execution.setVariable('x', 1);</activiti:string></activiti:field>\n  <activiti:field name=\"language\" value=\"groovy\"/>\n</activiti:executionListener>","handlingStrategy":"validation","validationCode":"assertListenerHasField(processDefinitionXml, \"ScriptExecutionListener\", \"language\");\n// and confirm the engine exists in the JVM\nnew ScriptEngineManager().getEngineByName(\"groovy\"); // non-null check in real code","typeGuard":null,"tryCatchPattern":"try {\n    repositoryService.createDeployment().addInputStream(\"p.bpmn\", xml).deploy();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"The field 'language' should be set\")) {\n        logger.error(\"ScriptExecutionListener missing <activiti:field name=\\\"language\\\">\");\n    }\n    throw e;\n}","preventionTips":["Always declare the language field together with script in ScriptExecutionListener.","Confirm the chosen scripting language's engine is on the classpath (e.g. groovy dependency).","Validate BPMN listener fields with automated tests before deployment.","Standardize on one scripting language per project to reduce configuration drift."],"tags":["bpmn","scripting","listener","missing-field"],"backgroundTag":"missing-required-config-field","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"}