flowable/flowable-engine · error · UnsupportedOperationException
org.flowable.cdi.impl.ProcessVariableMap.entrySet() is not…
Error message
org.flowable.cdi.impl.ProcessVariableMap.entrySet() is not supported.
What it means
ProcessVariableMap is a read-only, map-like view over CDI-resolved process variables in Flowable's CDI integration. It deliberately does not support bulk views such as values() or entrySet(), because process variables live in the engine, not in an in-memory map. Calling entrySet() immediately throws UnsupportedOperationException with this message.
Solutions
- Do not iterate the map directly; look up individual variables with get(name) instead.
- Use the Flowable API to enumerate variables: runtimeService.getVariables(executionId) or taskService.getVariables(taskId), which return a real Map.
- If you need a snapshot map, fetch variables via the engine services and copy that result, not the CDI ProcessVariableMap.
Example fix
// before
for (Map.Entry<String, Object> e : processVariables.entrySet()) { ... }
// after
Map<String, Object> vars = runtimeService.getVariables(executionId);
for (Map.Entry<String, Object> e : vars.entrySet()) { ... } Defensive patterns
Strategy: type-guard
Validate before calling
if (map instanceof ProcessVariableMap) { /* entrySet unsupported */ } Type guard
boolean isIterable(Map<String,Object> m) { return !(m instanceof org.flowable.cdi.impl.ProcessVariableMap); } Try / catch
try { map.entrySet().iterator(); } catch (UnsupportedOperationException e) { /* fall back to engine variable query */ } Prevention
- Never iterate CDI process-variable maps directly; fetch via RuntimeService/TaskService for enumeration
- When writing generic Map-consuming code, exclude engine-backed map views
When it happens
Trigger: Calling entrySet() (or values(), keySet()-style iteration) on a ProcessVariableMap instance obtained via CDI injection of @ProcessVariable Map<String,Object> or BusinessProcess.getProcessVariables()-style map access.
Common situations: Developers treat the injected process-variable map like a normal HashMap and try to iterate entries, stream over entrySet(), or copy it with new HashMap<>(processVariableMap), or log it via toString-based debugging that touches entrySet.
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
- org.flowable.cdi.impl.ProcessVariableMap.clear() is not…
- org.flowable.cdi.impl.ProcessVariableMap.containsKey() is…
- org.flowable.cdi.impl.ProcessVariableMap.containsValue() is…
- org.flowable.cdi.impl.ProcessVariableMap.isEmpty() is not…
- org.flowable.cdi.impl.ProcessVariableMap.keySet() is not…
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/7aa75e1ffba2cd08.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/ProcessVariableMap.java:102
@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)