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 placeholder VariableScope used when no execution exists (e.g. evaluating expressions outside a running execution). All mutating variable operations are intentionally unsupported and throw UnsupportedOperationException.

Solutions

  1. Obtain the real ExecutionEntity/DelegateExecution and set the variable on it instead
  2. Restructure logic so variable writes only happen inside an active execution (e.g. execution listeners, service tasks)
  3. Guard code with hasExecution checks before attempting writes when scope may be NoExecutionVariableScope
  4. Use a TaskEntity's scope (which has a backing execution) rather than a bare NoExecutionVariableScope

Example fix

// before
noExecutionScope.setVariable("status", "done");
// after
if (execution != null) { execution.setVariable("status", "done"); }
Defensive patterns

Strategy: type-guard

Validate before calling

if (scope instanceof NoExecutionVariableScope) {
  throw new IllegalStateException("Cannot set variables: no execution active");
}

Type guard

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

Try / catch

try {
  scope.setVariable(name, value);
} catch (UnsupportedOperationException e) {
  // no execution active: defer or log
  logger.warn("Variable {} not set: {}", name, e.getMessage());
}

Prevention

When it happens

Trigger: Calling setVariable(String, Object) on a NoExecutionVariableScope instance.

Common situations: Expressions or delegates evaluated without an active execution (e.g. task listeners on transient contexts, expression evaluation in unit tests without an execution); passing the wrong VariableScope into a helper that tries to persist a variable.

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

Appendix: source

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

    @Override
    public VariableInstance getVariableInstance(String variableName, boolean fetchAllVariables) {
        return null;
    }

    @Override
    public VariableInstance getVariableInstanceLocal(String variableName) {
        return null;
    }

    @Override
    public VariableInstance getVariableInstanceLocal(String variableName, boolean fetchAllVariables) {
        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");
    }

    @Override

View on GitHub (pinned to d6d39ce1c6)