flowable/flowable-engine · error · UnsupportedOperationException
Empty object, no variables can be removed
Error message
Empty object, no variables can be removed
What it means
Deliberate unsupported-operation sentinel: EmptyVariableScope is an immutable placeholder scope, so removeVariable (like all mutators) is hard-wired to throw; it fires only if code mutates the shared empty scope.
Solutions
- Guard with instanceof EmptyVariableScope and skip the removal.
- Fetch the live execution/task via runtimeService/taskService before removing.
- Perform removals during the active delegate execution.
- If nothing should remain, consider deleting the whole execution/instance instead of per-variable removal.
Example fix
// before
scope.removeVariable("tempData");
// after
if (!(scope instanceof EmptyVariableScope)) {
scope.removeVariable("tempData");
} Defensive patterns
Strategy: type-guard
Validate before calling
if (scope instanceof EmptyVariableScope) {
throw new IllegalStateException("Cannot remove variables from empty scope");
} Type guard
boolean isWritableScope(VariableScope scope) {
return scope != null && !(scope instanceof EmptyVariableScope);
} Try / catch
try {
scope.removeVariable(name);
} catch (UnsupportedOperationException e) {
if (e.getMessage() != null && e.getMessage().contains("Empty object")) {
logger.warn("Removal skipped: empty scope");
} else {
throw e;
}
} Prevention
- Guard removal paths with an EmptyVariableScope check.
- Remove variables via runtimeService/taskService with ids when the scope may be detached.
- Do cleanup during the active execution, not after instance completion.
- Treat EmptyVariableScope as read-only everywhere in your codebase.
When it happens
Trigger: Calling removeVariable(name) on EmptyVariableScope, e.g. cleanup code removing variables on a scope that resolved to the empty sentinel.
Common situations: Cleanup logic in delegates/listeners deleting variables after the process instance ended; generic variable-management helpers calling removeVariable on whatever scope they were handed.
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
- Empty object, no variables can be created
- Empty object, no variables can be set
- can't clear configuration beans
- can't search values in configuration beans
- Cannot change fixed value with
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/41d481a4e47be24b.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-variable-service-api/src/main/java/org/flowable/variable/api/delegate/EmptyVariableScope.java:210
return false;
}
@Override
public boolean hasVariableLocal(String variableName) {
return false;
}
public void createVariableLocal(String variableName, Object value) {
throw new UnsupportedOperationException("Empty object, no variables can be created");
}
public void createVariablesLocal(Map<String, ? extends Object> variables) {
throw new UnsupportedOperationException("Empty object, no variables can be created");
}
@Override
public void removeVariable(String variableName) {
throw new UnsupportedOperationException("Empty object, no variables can be removed");
}
@Override
public void removeVariableLocal(String variableName) {
throw new UnsupportedOperationException("Empty object, no variables can be removed");
}
@Override
public void removeVariables() {
throw new UnsupportedOperationException("Empty object, no variables can be removed");
}
@Override
public void removeVariablesLocal() {
throw new UnsupportedOperationException("Empty object, no variables can be removed");
}
@OverrideView on GitHub (pinned to d6d39ce1c6)