theonedev/onedev · error · java.lang.IllegalArgumentException
Unsupported message type: {message.getClass().getName()}
Error message
Unsupported message type: {message.getClass().getName()} What it means
createEventPayload converts a broadcast message object into a WebSocket payload, but only a fixed set of message types is supported (e.g. IWebSocketPushMessage, and the other instanceof branches above). Passing any other object type throws IllegalArgumentException with the message's class name, telling you which type is unsupported. This happens when broadcasting via IWebSocketProcessor.broadcastMessage with an object that does not implement one of the recognized interfaces.
Source
Thrown at server-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java:386
else if (message instanceof ConnectedMessage)
{
payload = new WebSocketConnectedPayload((ConnectedMessage) message, handler);
}
else if (message instanceof ClosedMessage)
{
payload = new WebSocketClosedPayload((ClosedMessage) message, handler);
}
else if (message instanceof AbortedMessage)
{
payload = new WebSocketAbortedPayload((AbortedMessage) message, handler);
}
else if (message instanceof IWebSocketPushMessage)
{
payload = new WebSocketPushPayload((IWebSocketPushMessage) message, handler);
}
else
{
throw new IllegalArgumentException("Unsupported message type: " + message.getClass().getName());
}
return payload;
}
protected IKey getRegistryKey()
{
IKey key;
if (Strings.isEmpty(resourceName))
{
key = new PageIdKey(pageId);
}
else
{
key = new ResourceNameKey(resourceName);
}
return key;
}
View on GitHub (pinned to d44925c47c)
Solutions
- Make the broadcast message class implement IWebSocketPushMessage (and implement createPushPayload/serialization as needed)
- Or broadcast a supported Wicket message type instead of a raw POJO
- Check the else-branch chain in createEventPayload for the full list of accepted types and pick the matching interface
Example fix
// before
session.broadcastMessage(new MyCustomEvent());
// after
public class MyPushMessage implements IWebSocketPushMessage { ... }
session.broadcastMessage(new MyPushMessage()); Defensive patterns
Strategy: type-guard
Validate before calling
if (!(message instanceof IWebSocketPushMessage)) {
throw new IllegalStateException("Broadcast message must implement IWebSocketPushMessage: " + message.getClass());
} Type guard
boolean isBroadcastable(Object m) {
return m instanceof IWebSocketPushMessage;
} Try / catch
try {
processor.broadcastMessage(message);
} catch (IllegalArgumentException e) {
log.error("Unsupported broadcast type: {}", message == null ? "null" : message.getClass(), e);
} Prevention
- Make all broadcast message classes implement IWebSocketPushMessage
- Add a unit test broadcasting every message type used in the app
- Never forward third-party event POJOs raw
When it happens
Trigger: Calling AbstractWebSocketProcessor.broadcastMessage(...)/createEventPayload(...) with a plain POJO that implements none of Wicket's IWebSocketMessage interfaces (IWebSocketPushMessage, connected/disconnected message types, etc.).
Common situations: Application code broadcasts a custom event object directly instead of wrapping it in a class implementing IWebSocketPushMessage; refactors drop an interface implementation; a third-party event is forwarded raw.
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
- The request should have either 'pageId' or 'resourceName' pa
- Conversation context lost
- Page classes should extend from BasePage.
- Base resource mapper should be used
- Invalid date range, expecting "yyyy-MM-dd to yyyy-MM-dd"
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/cf2d31a342732af4.
Report an issue: GitHub.