quarkusio/quarkus · error · UnsupportedOperationException
UnsupportedOperationException
Error message
UnsupportedOperationException
What it means
The iterator returned by ImmutableSubstringMap's values/lookup does not support element removal: calling remove() on it unconditionally throws UnsupportedOperationException. This is an immutable snapshot structure, so mutation through the iterator is intentionally unsupported.
Source
Thrown at extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/ImmutableSubstringMap.java:222
}
@Override
public String next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
String ret = (String) map[pos];
pos += 2;
while (pos < table.length && tMap[pos] == null) {
pos += 2;
}
return ret;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
};
}
ImmutableSubstringMap<V> build() {
return new ImmutableSubstringMap<>(table);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Do not call remove() on this iterator; build a new ImmutableSubstringMap without the unwanted entries instead.
- Collect the keys/values you want to drop and rebuild the map.
- If mutation is required, use a mutable Map during construction before wrapping in ImmutableSubstringMap.
Example fix
// before it.remove(); // after Map<String,V> copy = new HashMap<>(existing); copy.remove(key); ImmutableSubstringMap<V> updated = rebuild(copy);
Defensive patterns
Strategy: try-catch
Validate before calling
// avoid mutation: do not call remove() on ImmutableSubstringMap iterators
Try / catch
try (var it = map.iterator()) {
while (it.hasNext()) { process(it.next()); }
} catch (UnsupportedOperationException e) {
// snapshot iterator: rebuild map without the entry instead of removing
} Prevention
- Treat ImmutableSubstringMap as read-only
- Rebuild the map to remove entries
- Never call Iterator.remove() on snapshot iterators
When it happens
Trigger: Calling Iterator.remove() on an iterator obtained from ImmutableSubstringMap (e.g. while iterating its values) or any library code that tries to mutate through it.
Common situations: Developers porting mutable-map iteration code, or trying to prune entries while iterating a read-only lookup structure.
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
- Stateless operations not supported
- This isn't used for schema generation - see SessionFactoryOb
- This method is not available at runtime in Quarkus
- Use the 'OidcClientCommonConfigBuilder.CredentialsBuilder#bu
- Cannot call a page related method, call page(Page) or page(i
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f43ecec986daf553.
Report an issue: GitHub.