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.removeVariable(name) always throws UnsupportedOperationException because deleting a variable requires an execution or task that owns it; this stub has neither. The throw is deliberate design so accidental writes on a read-only, execution-less scope fail immediately.

Solutions

  1. Use an execution-backed scope or runtimeService.removeVariable(executionId, name)
  2. Guard removal with an instanceof NoExecutionVariableScope check
  3. Restrict NoExecutionVariableScope to read-only evaluation paths

Example fix

// before
scope.removeVariable("temp"); // throws
// after
runtimeService.removeVariable(executionId, "temp");
Defensive patterns

Strategy: try-catch

Validate before calling

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

Type guard

boolean supportsVariableRemoval(VariableScope scope) {
    return !(scope instanceof NoExecutionVariableScope);
}

Try / catch

try {
    scope.removeVariable(name);
} catch (UnsupportedOperationException e) {
    if (e.getMessage().contains("No execution active")) {
        runtimeService.removeVariable(executionId, name);
    } else throw e;
}

Prevention

When it happens

Trigger: Calling removeVariable(String) on a NoExecutionVariableScope reference, e.g. from generic VariableScope-consuming code paths or listeners evaluated without an execution.

Common situations: Cleanup logic in delegates assuming an execution scope; standalone EL evaluation contexts; unit tests reusing the stub.

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/cd4ffac3cfb3fe88. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/el/NoExecutionVariableScope.java:229

        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)