flowable/flowable-engine · error · FlowableException
condition script returns null: for
Error message
condition script returns null: for
What it means
FlowableException thrown by ScriptCondition.evaluate when a condition expression script executes but its result is null. Conditional sequence flows (e.g. exclusive gateways) require a Boolean answer, so a null result makes the routing decision impossible.
Solutions
- Make the condition script explicitly return a boolean (e.g. return amount > 100 in groovy/js).
- Check the referenced process variables exist and are non-null before the gateway, or use null-safe defaults in the expression.
- Verify the condition language is correct for the expression semantics; inspect the execution object in the message to see which variables were present.
- Catch FlowableException around the engine call / API invocation and log the expression for diagnosis.
Example fix
// before (groovy condition, may return null) amount // after return amount != null ? amount > 100 : false
Defensive patterns
Strategy: validation
Validate before calling
Object amount = execution.getVariable("amount");
if (amount == null) {
execution.setVariable("amount", BigDecimal.ZERO);
} Try / catch
try {
boolean take = condition.evaluate(scriptingEngines, execution, language, expression);
} catch (FlowableException e) {
log.error("condition '{}' failed for {}: {}", expression, execution, e.getMessage());
throw e;
} Prevention
- Always write conditions as explicit boolean comparisons
- Initialize process variables with defaults before gateways
- Test each conditional flow branch with null and edge-case variables
- Avoid scripts with no return statement in conditions
When it happens
Trigger: A gateway/boundary condition expression like ${language} (or a script condition with a language such as groovy/javascript) whose script evaluates to null — e.g. returning a missing variable, an empty return, or a method returning null.
Common situations: Referencing a process variable that is not set; script body with no explicit return statement; a helper method returning null for edge-case inputs; typo in variable name so EL resolves to null.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- condition script returns non-Boolean: () for
- Class or class name is missing
- condition expression returns non-Boolean
- condition expression returns null
- condition script returns non-Boolean
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/2f30f340db31f224.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/scripting/ScriptCondition.java:45
private final String expression;
private final String language;
public ScriptCondition(String expression, String language) {
this.expression = expression;
this.language = language;
}
@Override
public boolean evaluate(String elementId, DelegateExecution execution) {
ScriptingEngines scriptingEngines = CommandContextUtil.getProcessEngineConfiguration().getScriptingEngines();
ScriptEngineRequest.Builder builder = ScriptEngineRequest.builder()
.script(expression)
.language(language)
.scopeContainer(execution);
Object result = scriptingEngines.evaluate(builder.build()).getResult();
if (result == null) {
throw new FlowableException("condition script returns null: " + expression + " for " + execution);
}
if (!(result instanceof Boolean)) {
throw new FlowableException("condition script returns non-Boolean: " + result + " (" + result.getClass().getName() + ") for " + execution);
}
return (Boolean) result;
}
}
View on GitHub (pinned to d6d39ce1c6)