flowable/flowable-engine · error · UnsupportedOperationException

No execution active, no variables can be created

Error message

No execution active, no variables can be created

What it means

NoExecutionVariableScope.createVariableLocal(name, value) always throws UnsupportedOperationException; unlike the interface setters, variable creation is an internal write that needs an execution to attach the new VariableInstanceEntity to. The stub deliberately rejects it because there is no execution active.

Solutions

  1. Provide a real execution-backed scope before creating variables
  2. Create variables via RuntimeService/TaskService with an executionId/taskId
  3. Intercept this scope type earlier in your code and fail with a clearer message

Example fix

// before
scope.createVariableLocal("created", Instant.now()); // throws
// after
executionEntity.createVariableLocal("created", Instant.now());
Defensive patterns

Strategy: try-catch

Validate before calling

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

Type guard

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

Try / catch

try {
    scope.createVariableLocal(name, value);
} catch (UnsupportedOperationException e) {
    if (e.getMessage().contains("No execution active")) {
        // create via executionEntity or runtimeService instead
    } else throw e;
}

Prevention

When it happens

Trigger: Calling createVariableLocal(String, Object) on a NoExecutionVariableScope, typically from internal service code or delegates using the internal VariableScopeImpl.createVariableLocal API.

Common situations: Internal listeners or scripts resolving variables without an execution; test code; framework glue that assumes an ExecutionEntity is present.

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

Appendix: source

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

    }

    @Override
    public boolean hasVariablesLocal() {
        return false;
    }

    @Override
    public boolean hasVariable(String variableName) {
        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() {

View on GitHub (pinned to d6d39ce1c6)