flowable/flowable-engine · error · UnsupportedOperationException
No execution active, no variables can be set
Error message
No execution active, no variables can be set
What it means
NoExecutionVariableScope is a VariableScope stub used by the EL/ expression layer when evaluation happens outside any execution (e.g. in a standalone expression evaluation). All mutating operations are intentionally unsupported: calling setVariable(name, value) on it always throws UnsupportedOperationException. It signals that variable writes require an active execution/execution context.
Solutions
- Use a real execution-backed scope (DelegateExecution, TaskEntity, ExecutionEntity) instead of NoExecutionVariableScope for writes
- Restrict the code path to read-only operations when no execution is active
- Construct a VariableScopeImpl or a mock scope in tests when you need setVariable support
- Check instanceof NoExecutionVariableScope before attempting variable writes
Example fix
// before
VariableScope scope = new NoExecutionVariableScope();
scope.setVariable("count", 3); // throws
// after
ExecutionEntity execution = runtimeService.createExecutionQuery().executionId(id).singleResult();
runtimeService.setVariable(execution.getId(), "count", 3); Defensive patterns
Strategy: try-catch
Validate before calling
if (scope instanceof NoExecutionVariableScope) {
throw new IllegalStateException("Cannot set variables without an execution");
} Type guard
boolean canWriteVariables(VariableScope scope) {
return !(scope instanceof NoExecutionVariableScope);
} Try / catch
try {
scope.setVariable("k", v);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("No execution active")) {
// fall back to service API with explicit executionId
} else throw e;
} Prevention
- Never use NoExecutionVariableScope in code paths that write variables
- Pass DelegateExecution/DelegateTask from delegates rather than a stub scope
- Keep expression evaluation that needs writes inside process execution contexts
- In tests, use a mock VariableScope with write support instead of the stub
When it happens
Trigger: Calling setVariable(String, Object) on a VariableScope reference that actually is NoExecutionVariableScope, typically an expression or delegate getting a scope that is not backed by an ExecutionEntity/TaskEntity.
Common situations: Evaluating expressions with a manually constructed VariableScope; unit-test code reusing NoExecutionVariableScope as a dummy; Spring/CDN beans or JUEL expressions resolving variables outside a process context (e.g. in a listener without an execution).
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- No execution active, no variables can be created
- No execution active, no variables can be created
- No execution active, no variables can be removed
- No execution active, no variables can be set
- Setting variable is not supported for read only delegate…
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/8425929eb1e32acd.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/el/NoExecutionVariableScope.java:171
@Override
public VariableInstance getVariableInstanceLocal(String variableName, boolean fetchAllVariables) {
return null;
}
@SuppressWarnings("unchecked")
@Override
public Set<String> getVariableNames() {
return Collections.EMPTY_SET;
}
@Override
public Set<String> getVariableNamesLocal() {
return null;
}
@Override
public void setVariable(String variableName, Object value) {
throw new UnsupportedOperationException("No execution active, no variables can be set");
}
@Override
public void setVariable(String variableName, Object value, boolean fetchAllVariables) {
throw new UnsupportedOperationException("No execution active, no variables can be set");
}
@Override
public Object setVariableLocal(String variableName, Object value) {
throw new UnsupportedOperationException("No execution active, no variables can be set");
}
@Override
public Object setVariableLocal(String variableName, Object value, boolean fetchAllVariables) {
throw new UnsupportedOperationException("No execution active, no variables can be set");
}
@OverrideView on GitHub (pinned to d6d39ce1c6)