flowable/flowable-engine · error · UnsupportedOperationException

org.flowable.cdi.impl.ProcessVariableMap.keySet() is not…

Error message

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

What it means

ProcessVariableMap.keySet() throws UnsupportedOperationException unconditionally. The map view has no listing capability; variable names can only be obtained through the process engine's variable query APIs.

Solutions

  1. Use the process engine API (e.g. VariableScope.getVariableNames() or runtime/task variable queries) to list variable names.
  2. Track your own variable names in a plain collection if you need iteration.
  3. Avoid generic Map iteration over this CDI map.

Example fix

// before
for (String name : processVariableMap.keySet()) { ... }

// after
for (String name : execution.getVariableNames()) { ... } // use the engine's VariableScope API
Defensive patterns

Strategy: try-catch

Try / catch

try { names = processVariableMap.keySet(); } catch (UnsupportedOperationException e) { names = execution.getVariableNames(); /* engine API */ }

Prevention

When it happens

Trigger: Calling keySet() directly, iterating the map in a for-each over keys, or calling code such as Map copy constructors, logging of keys, or key-based serialization that invokes keySet().

Common situations: Dumping all process variables for debugging; copying variables into another map; frameworks that enumerate Map keys for binding/serialization.

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

Appendix: source

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

    @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)