flowable/flowable-engine · error · FlowableIllegalArgumentException

language is empty

Error message

language is empty

What it means

The builder method FlowableScriptEvaluationRequest.language(String) validates its argument and throws FlowableIllegalArgumentException when the language string is null or empty. This is an eager fail-fast check so an invalid request is rejected before any engine lookup happens.

Solutions

  1. Pass a non-empty engine name, e.g. language("javascript") or language("groovy").
  2. Validate/resolve the source of the language value (BPMN attribute, property) before building the request.
  3. Apply a default language when the input is blank.

Example fix

// before
request.language(config.get("script.language"));

// after
String lang = config.getOrDefault("script.language", "javascript");
if (lang == null || lang.isEmpty()) throw new IllegalStateException("script.language must be set");
request.language(lang);
Defensive patterns

Strategy: validation

Validate before calling

if (language == null || language.trim().isEmpty()) {
    throw new IllegalArgumentException("language must be a non-empty engine name");
}

Type guard

boolean hasLanguage(String s) { return s != null && !s.trim().isEmpty(); }

Try / catch

try {
    request.language(lang);
} catch (FlowableIllegalArgumentException e) {
    throw new ConfigurationException("Script language not set; check BPMN attribute or config", e);
}

Prevention

When it happens

Trigger: Calling new FlowableScriptEvaluationRequest().language(null) or language("") — typically when the language is read from a variable, config property, or BPMN attribute that is unset.

Common situations: A script task's language attribute omitted or empty in the process XML; a config property placeholder that did not resolve; dynamic language selection code passing an empty string.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

    public ScriptEngineManager getScriptEngineManager() {
        return scriptEngineManager;
    }


    protected class JavaScriptingFlowableScriptEvaluationRequest implements FlowableScriptEvaluationRequest {

        protected String language;
        protected String script;
        protected Resolver resolver;
        protected VariableContainer scopeContainer;
        protected VariableContainer inputVariableContainer;
        protected boolean storeScriptVariables;

        @Override
        public FlowableScriptEvaluationRequest language(String language) {
            if (StringUtils.isEmpty(language)) {
                throw new FlowableIllegalArgumentException("language is empty");
            }
            this.language = language;
            return this;
        }

        @Override
        public FlowableScriptEvaluationRequest script(String script) {
            if (StringUtils.isEmpty(script)) {
                throw new FlowableIllegalArgumentException("script is empty");
            }
            this.script = script;
            return this;
        }

        @Override
        public FlowableScriptEvaluationRequest resolver(Resolver resolver) {
            this.resolver = resolver;
            return this;

View on GitHub (pinned to d6d39ce1c6)