theonedev/onedev · error · IllegalStateException

has not been properly detached. Something in the hierarchy

Error message

 has not been properly detached. Something in the hierarchy of 

What it means

After rendering, Component checks FLAG_AFTER_RENDERING; this flag is cleared only in Component.onAfterRender(). If an override of onAfterRender() in the hierarchy does not call super.onAfterRender(), the flag remains set and Wicket throws this IllegalStateException, indicating the render lifecycle was not completed cleanly.

Source

Thrown at server-core/src/main/java/org/apache/wicket/Component.java:931

	/**
	 * Called on every component after the page is rendered. It will call onAfterRender for it self
	 * and its children.
	 */
	public final void afterRender()
	{
		try
		{
			setFlag(FLAG_AFTER_RENDERING, true);

			// always detach children because components can be attached
			// independently of their parents
			onAfterRenderChildren();

			onAfterRender();
			getApplication().getComponentOnAfterRenderListeners().onAfterRender(this);
			if (getFlag(FLAG_AFTER_RENDERING))
			{
				throw new IllegalStateException(Component.class.getName() +
					" has not been properly detached. Something in the hierarchy of " +
					getClass().getName() +
					" has not called super.onAfterRender() in the override of onAfterRender() method");
			}
		}
		finally
		{
			// this flag must always be set to false.
			markRendering(false);
		}
	}

	/**
	 * 
	 */
	private void internalBeforeRender()
	{
		configure();

View on GitHub (pinned to d44925c47c)

Solutions

  1. Find the onAfterRender() override in the named class hierarchy
  2. Add super.onAfterRender() to the override
  3. Verify no early return/exception path skips the super call

Example fix

// before
@Override
protected void onAfterRender() {
    cleanup();
}
// after
@Override
protected void onAfterRender() {
    super.onAfterRender();
    cleanup();
}
Defensive patterns

Strategy: validation

Validate before calling

@Override
protected void onAfterRender() {
    try {
        cleanup();
    } finally {
        super.onAfterRender();
    }
}

Prevention

When it happens

Trigger: An override of onAfterRender() omits super.onAfterRender(); the component finishes rendering and Wicket performs the post-render check.

Common situations: Custom components adding cleanup logic to onAfterRender(); code migrated from Wicket versions that did not verify super calls.

Related errors


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