theonedev/onedev · error · java.lang.IllegalArgumentException
The request should have either 'pageId' or 'resourceName' pa
Error message
The request should have either 'pageId' or 'resourceName' parameter!
What it means
Wicket's AbstractWebSocketProcessor requires every WebSocket upgrade request to identify its target: either a 'pageId' parameter (a page-scoped connection) or a 'resourceName' parameter (an application-scoped WebSocket resource). If both are empty the constructor throws IllegalArgumentException because there is no valid registry key to attach the connection to. This is a programming or configuration error in how the WebSocket endpoint URL was built.
Source
Thrown at server-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java:122
* the http request that was used to create the TomcatWebSocketProcessor
* @param application
* the current Wicket Application
*/
public AbstractWebSocketProcessor(final HttpServletRequest request, final WebApplication application)
{
final HttpSession httpSession = request.getSession(true);
if (httpSession == null)
{
throw new IllegalStateException("There is no HTTP Session bound. Without a session Wicket won't be " +
"able to find the stored page to update its components");
}
this.sessionId = httpSession.getId();
String pageId = request.getParameter("pageId");
resourceName = request.getParameter("resourceName");
if (Strings.isEmpty(pageId) && Strings.isEmpty(resourceName))
{
throw new IllegalArgumentException("The request should have either 'pageId' or 'resourceName' parameter!");
}
if (Strings.isEmpty(pageId) == false)
{
this.pageId = Integer.parseInt(pageId, 10);
}
else
{
this.pageId = NO_PAGE_ID;
}
String baseUrl = request.getParameter(WebRequest.PARAM_AJAX_BASE_URL);
Checks.notNull(baseUrl, String.format("Request parameter '%s' is required!", WebRequest.PARAM_AJAX_BASE_URL));
this.baseUrl = Url.parse(baseUrl);
WicketFilter wicketFilter = application.getWicketFilter();
this.servletRequest = new ServletRequestCopy(request);
this.application = Args.notNull(application, "application");View on GitHub (pinned to d44925c47c)
Solutions
- Use Wicket's WebSocketRequestHandler/WebSocketBehavior-generated connection URL instead of hardcoding it, so pageId/resourceName are always appended
- For an application-scoped connection, mount the WebSocket resource with a resourceName and include ?resourceName=<name> in the URL
- For a page-scoped connection, render the URL via the page containing the WebSocketBehavior so ?pageId=<page id> is included
- Log the incoming request URL to confirm no proxy/filter strips the query string
Example fix
// before
new WebSocket('ws://host/wicket/websocket');
// after
// let Wicket generate the URL from the behavior's callback script,
// which appends e.g. ?pageId=1 (page-scoped) or ?resourceName=echo (app-scoped) Defensive patterns
Strategy: validation
Validate before calling
// before opening the WS connection
const params = new URLSearchParams(url);
if (!params.has('pageId') && !params.has('resourceName')) {
throw new Error('WebSocket URL must include pageId or resourceName');
} Try / catch
// server-side
try {
new MyWebSocketProcessor(request);
} catch (IllegalArgumentException e) {
log.warn("WebSocket request missing pageId/resourceName: {}", request.getRequestURL());
// reject the upgrade
} Prevention
- Always obtain the WS URL from Wicket-generated callback script, never hardcode
- For app-scoped sockets include ?resourceName= in the URL
- Verify proxies don't strip query strings
- Write an integration test that performs the WS handshake with the mounted resource
When it happens
Trigger: Constructing AbstractWebSocketProcessor (or a subclass) with an HttpServletRequest whose query string lacks both 'pageId' and 'resourceName'; hand-crafting a WebSocket connect URL without the parameters Wicket's WebSocketBehavior normally appends; a reverse proxy stripping query parameters.
Common situations: Manually writing JS like new WebSocket('ws://host/wicket/websocket') without the pageId/resourceName query params; proxy configs rewriting the URL; upgrading Wicket versions where the resource path changed so old hardcoded URLs miss parameters.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Unsupported message type: {message.getClass().getName()}
- Conversation context lost
- Job name is required
- Page classes should extend from BasePage.
- Base resource mapper should be used
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/27a3bc1aa00d52c1.
Report an issue: GitHub.