flowable/flowable-engine · error · FlowableIllegalStateException

The field 'language' should be set on " +…

Error message

The field 'language' should be set on " + getClass().getSimpleName()

What it means

validateParameters() found the 'language' field null on a script evaluator, meaning no script language was configured, so no ScriptEngine can be resolved. The concrete class name is included in the message.

Solutions

  1. Call setLanguage("groovy" / "javascript" / ...) on the evaluator before use
  2. Set the language attribute on the script task/listener in BPMN XML
  3. Inject the language property in the bean/deployment configuration

Example fix

// before
GroovyScriptEvaluator eval = new GroovyScriptEvaluator();
eval.setScript("return 1;");
// after
GroovyScriptEvaluator eval = new GroovyScriptEvaluator();
eval.setScript("return 1;");
eval.setLanguage("groovy");
Defensive patterns

Strategy: validation

Validate before calling

if (evaluator.getLanguage() == null) {
    throw new IllegalStateException("language property not injected on " + evaluator.getClass().getSimpleName());
}

Try / catch

try {
    return evaluator.createScriptRequest(variableContainer).build();
} catch (FlowableIllegalStateException e) {
    if (e.getMessage().contains("field 'language'")) {
        throw new IllegalStateException("Configure the language property on " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Instantiating an AbstractScriptEvaluator subclass without calling setLanguage(...) and then invoking createScriptRequest()/evaluate; differs from error 1797 in that the language Expression itself is null rather than evaluating to null.

Common situations: Custom listener/delegate missing the language property in Spring config; BPMN script task without language attribute; older BPMN files migrated to a Flowable version requiring explicit language.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/60af4b068d00c967. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/AbstractScriptEvaluator.java:103

            String resultVariable = Objects.toString(this.resultVariable.getValue(variableContainer), null);
            if (variableContainer != null && resultVariable != null) {
                variableContainer.setVariable(resultVariable, result);
            }
        }
        return result;
    }

    protected Object evaluateScript(ScriptingEngines scriptingEngines, ScriptEngineRequest request) {
        return scriptingEngines.evaluate(request).getResult();
    }

    protected void validateParameters() {
        if (script == null) {
            throw new FlowableIllegalStateException("The field 'script' should be set on " + getClass().getSimpleName());
        }

        if (language == null) {
            throw new FlowableIllegalStateException("The field 'language' should be set on " + getClass().getSimpleName());
        }
    }

    protected abstract ScriptingEngines getScriptingEngines();

    public void setScript(String script) {
        this.script = script;
    }

    /**
     * Sets the script as Expression for backwards compatibility.
     * Requires to for 'field' injection of scripts.
     * Expression is not evaluated
     */
    public void setScript(Expression script) {
        this.script = script.getExpressionText();
    }

View on GitHub (pinned to d6d39ce1c6)