flowable/flowable-engine · error · FlowableIllegalArgumentException
script is required
Error message
script is required
What it means
FlowableScriptEvaluationRequest.evaluate() re-validates the request before executing: if the script field was never set (null or empty) it throws FlowableIllegalArgumentException('script is required'). This is the evaluate-time counterpart of the builder-time 'script is empty' check.
Solutions
- Always call script(<code>) with non-empty script text before evaluate().
- Validate the script source (variable, file, template) before constructing the request.
- Fail early with a domain-specific message when the script source is blank.
Example fix
// before
var req = new FlowableScriptEvaluationRequest().language("groovy");
req.evaluate();
// after
var req = new FlowableScriptEvaluationRequest()
.language("groovy")
.script("return x * 2");
req.evaluate(); Defensive patterns
Strategy: validation
Validate before calling
if (script == null || script.trim().isEmpty()) {
throw new IllegalStateException("Cannot evaluate script: script was never set on the request");
} Type guard
boolean isEvaluableRequest(FlowableScriptEvaluationRequest r) { return r != null && r.getScript() != null && !r.getScript().isEmpty(); } Try / catch
try {
return request.evaluate();
} catch (FlowableIllegalArgumentException e) {
throw new IllegalStateException("Script request incomplete: " + e.getMessage(), e);
} Prevention
- Resolve script content from variables/templates before building the request.
- Use a factory method that requires (language, script) pairs.
- Fail at template/resource load time if the resolved script is blank.
When it happens
Trigger: Building a FlowableScriptEvaluationRequest without calling script(...) and invoking evaluate(); or the script text was set from a source that returned null/empty after the builder check path was bypassed.
Common situations: Programmatic script evaluation with conditionally omitted script body; process variables/expressions expected to supply the script content but resolving to empty.
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
- A script is required
- language is required
- A resource name is mandatory
- An event definition key is mandatory
- language is empty
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/2a78d9c7156d7e0b.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/JSR223FlowableScriptEngine.java:194
public FlowableScriptEvaluationRequest inputVariableContainer(VariableContainer inputVariableContainer) {
this.inputVariableContainer = inputVariableContainer;
return this;
}
@Override
public FlowableScriptEvaluationRequest storeScriptVariables() {
this.storeScriptVariables = true;
return this;
}
@Override
public ScriptEvaluation evaluate() throws FlowableScriptException {
if (StringUtils.isEmpty(language)) {
throw new FlowableIllegalArgumentException("language is required");
}
if (StringUtils.isEmpty(script)) {
throw new FlowableIllegalArgumentException("script is required");
}
ScriptEngine scriptEngine = getEngineByName(language);
Bindings bindings = createBindings();
try {
Object result = scriptEngine.eval(script, bindings);
return new ScriptEvaluationImpl(resolver, result);
} catch (ScriptException e) {
throw new FlowableScriptException(e.getMessage(), e);
}
}
protected Bindings createBindings() {
return new ScriptBindings(Collections.singletonList(resolver), scopeContainer, inputVariableContainer, storeScriptVariables);
}
}
}
View on GitHub (pinned to d6d39ce1c6)