theonedev/onedev · error · java.lang.IllegalArgumentException

cannot update component that does not have setOutputMarkupId

Error message

cannot update component that does not have setOutputMarkupId property set to true. Component: {component.toString()}

What it means

WebSocketRequestHandler.add(components...) re-renders components on the client via JavaScript, which requires each component's HTML id attribute to be present in the markup. Wicket only renders that id when setOutputMarkupId(true) is set, so any component with outputMarkupId==false throws IllegalArgumentException immediately. The component is never partially updated; the whole request fails.

Source

Thrown at server-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java:152

						OneDev.getInstance(WebSocketService.class).observe((BasePage) getPage());
					super.onAfterRespond(response);
				}
				
			};
		}
		return update;
	}

	@Override
	public void add(Component... components)
	{
		for (final Component component : components)
		{
			Args.notNull(component, "component");

			if (component.getOutputMarkupId() == false)
			{
				throw new IllegalArgumentException(
						"cannot update component that does not have setOutputMarkupId property set to true. Component: " +
								component.toString());
			}
			add(component, component.getMarkupId());
		}
	}

	@Override
	public final void addChildren(MarkupContainer parent, Class<?> childCriteria)
	{
		Args.notNull(parent, "parent");
		Args.notNull(childCriteria, "childCriteria");

		parent.visitChildren(childCriteria, new IVisitor<Component, Void>()
		{
			@Override
			public void component(final Component component, final IVisit<Void> visit)
			{

View on GitHub (pinned to d44925c47c)

Solutions

  1. Call setOutputMarkupId(true) on the component in its constructor or onInitialize before it is added to the handler
  2. Set it once in the component class so every instance is updatable
  3. If you must add many components, iterate and set the flag before handler.add

Example fix

// before
Label name = new Label("name", model);
target.add(name); // throws
// after
Label name = new Label("name", model);
name.setOutputMarkupId(true);
target.add(name);
Defensive patterns

Strategy: validation

Validate before calling

// Java
if (!component.getOutputMarkupId()) {
    component.setOutputMarkupId(true);
}
handler.add(component);

Try / catch

try {
    handler.add(component);
} catch (IllegalArgumentException e) {
    log.warn("Component not repaintable, missing markup id", e);
}

Prevention

When it happens

Trigger: Calling webSocketRequestHandler.add(component) (or add(c1, c2, ...)) where at least one component never had setOutputMarkupId(true) called, including via setOutputMarkupPlaceholderTag(true).

Common situations: Adding components created in code without markup id output; a component moved between pages/handlers; newly added children in an AJAX/WS handler that were assumed to inherit the setting (they do not).

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/b03f27faa05fbaef. Report an issue: GitHub.