flowable/flowable-engine · error · UnsupportedOperationException

No execution active, no variables can be removed

Error message

No execution active, no variables can be removed

What it means

NoExecutionVariableScope is a VariableScope stub used when EL/expression evaluation happens without an active execution (e.g. outside a process instance). removeVariable is one of many mutating VariableScope methods deliberately unsupported here; calling it throws UnsupportedOperationException because there is no execution to hold variables.

Solutions

  1. Do not mutate variables on NoExecutionVariableScope; obtain the real ExecutionEntity/DelegateExecution and call its removeVariable
  2. Guard variable-mutation code with a check that the execution is active before calling removeVariable
  3. In tests, replace NoExecutionVariableScope with a mock/real VariableScope implementation before exercising variable APIs
  4. If you only need read access, use getVariable (returns null) instead of mutating APIs

Example fix

// before
scope.removeVariable("orderStatus"); // UnsupportedOperationException
// after
if (delegateExecution != null) {
    delegateExecution.removeVariable("orderStatus");
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (scope instanceof NoExecutionVariableScope) {
    throw new IllegalStateException("No execution active: cannot remove variable");
}

Type guard

function hasActiveExecution(scope) {
    return scope != null && !(scope instanceof NoExecutionVariableScope);
}

Try / catch

try {
    scope.removeVariable(name);
} catch (UnsupportedOperationException e) {
    log.warn("No active execution; variable {} not removed", name, e);
}

Prevention

When it happens

Trigger: Calling removeVariable(String) on a NoExecutionVariableScope instance, i.e. evaluating/removing variables in a context with no execution, such as expression evaluation outside a process or a custom delegate receiving this scope.

Common situations: Custom JavaDelegate/Expression code invoking variable mutations on the wrong scope object; reusing VariableScope references after the execution has ended; unit tests instantiating NoExecutionVariableScope and calling write APIs.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/84f7bb423c7df18d. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/el/NoExecutionVariableScope.java:228

        return false;
    }

    @Override
    public boolean hasVariableLocal(String variableName) {
        return false;
    }

    public void createVariableLocal(String variableName, Object value) {
        throw new UnsupportedOperationException("No execution active, no variables can be created");
    }

    public void createVariablesLocal(Map<String, ? extends Object> variables) {
        throw new UnsupportedOperationException("No execution active, no variables can be created");
    }

    @Override
    public void removeVariable(String variableName) {
        throw new UnsupportedOperationException("No execution active, no variables can be removed");
    }

    @Override
    public void removeVariableLocal(String variableName) {
        throw new UnsupportedOperationException("No execution active, no variables can be removed");
    }

    @Override
    public void removeVariables() {
        throw new UnsupportedOperationException("No execution active, no variables can be removed");
    }

    @Override
    public void removeVariablesLocal() {
        throw new UnsupportedOperationException("No execution active, no variables can be removed");
    }

    @Override

View on GitHub (pinned to d6d39ce1c6)