flowable/flowable-engine · error · UnsupportedOperationException

org.flowable.cdi.impl.ProcessVariableMap.clear() is not supp

Error message

org.flowable.cdi.impl.ProcessVariableMap.clear() is not supported.

What it means

ProcessVariableMap.clear() throws UnsupportedOperationException unconditionally. Bulk-deleting every process variable is not a safe or supported operation through this view; there is no way to enumerate variables, and clearing all variables of a process would be destructive.

Source

Thrown at modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/ProcessVariableMap.java:87

    @Override
    public boolean containsKey(Object key) {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".containsKey() is not supported.");
    }

    @Override
    public boolean containsValue(Object value) {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".containsValue() is not supported.");
    }

    @Override
    public Object remove(Object key) {
        throw new UnsupportedOperationException("ProcessVariableMap.remove is unsupported. Use ProcessVariableMap.put(key, null)");
    }

    @Override
    public void clear() {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".clear() is not supported.");
    }

    @Override
    public Set<String> keySet() {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".keySet() is not supported.");
    }

    @Override
    public Collection<Object> values() {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".values() is not supported.");
    }

    @Override
    public Set<Map.Entry<String, Object>> entrySet() {
        throw new UnsupportedOperationException(ProcessVariableMap.class.getName() + ".entrySet() is not supported.");
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Remove variables individually with put(name, null) for the ones you own.
  2. Let the process engine manage variable lifetime (they are removed with the execution/task).
  3. Never pass this map into reset/cleanup utilities expecting Map.clear().

Example fix

// before
processVariableMap.clear();

// after
processVariableMap.put("tempVar", null);
processVariableMap.put("otherTempVar", null); // clear only variables you explicitly set
Defensive patterns

Strategy: try-catch

Try / catch

try { processVariableMap.clear(); } catch (UnsupportedOperationException e) { /* remove variables individually with put(name, null) */ }

Prevention

When it happens

Trigger: Calling clear() directly, or indirectly from helpers that reset maps between uses (test fixtures, pooled contexts, framework reset hooks).

Common situations: Test teardown code resetting CDI state; generic code that clears any Map before reuse.

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