flowable/flowable-engine · error · FlowableIllegalArgumentException

script is empty

Error message

script is empty

What it means

The builder method FlowableScriptEvaluationRequest.script(String) validates its argument and throws FlowableIllegalArgumentException when the script text is null or empty. The engine refuses to evaluate a request with no script body.

Solutions

  1. Pass the actual script text, e.g. script("return input;").
  2. Check the resource/property that supplies the script content and fail earlier with a clear message if blank.
  3. Log the loaded script length before building the request to catch empty loads.

Example fix

// before
String script = loadScript(path);
request.script(script);

// after
String script = loadScript(path);
if (script == null || script.trim().isEmpty()) throw new IllegalStateException("Script resource is empty: " + path);
request.script(script);
Defensive patterns

Strategy: validation

Validate before calling

if (script == null || script.trim().isEmpty()) {
    throw new IllegalArgumentException("script text must be non-empty (check resource/variable source)");
}

Type guard

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

Try / catch

try {
    request.script(scriptText);
} catch (FlowableIllegalArgumentException e) {
    throw new ConfigurationException("Script content is empty; verify the script source", e);
}

Prevention

When it happens

Trigger: Calling request.script(null) or script("") — usually when the script text is loaded from a resource that failed to load, or a BPMN script element has an empty body.

Common situations: A classpath resource containing the script was not found and the loader returned an empty string; an empty <flowable:script> element in the process definition; template generation produced an empty script.

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/875517995bb02e64. Report an issue: GitHub.

Appendix: source

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

        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;
        }

        @Override
        public FlowableScriptEvaluationRequest scopeContainer(VariableContainer scopeContainer) {
            this.scopeContainer = scopeContainer;
            return this;
        }

        @Override

View on GitHub (pinned to d6d39ce1c6)