theonedev/onedev · error · IllegalStateException

has not been properly added. Something in the hierarchy of

Error message

 has not been properly added. Something in the hierarchy of 

What it means

When a component that was removed is added back to a page, Component calls onReAdd() and then checks RFLAG_ON_RE_ADD_SUPER_CALL_VERIFIED. The flag is set inside Component.onReAdd(); if an override in the class hierarchy fails to call super.onReAdd(), Wicket throws this IllegalStateException to signal the lifecycle contract was violated.

Source

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

				if (!getRequestFlag(RFLAG_INITIALIZE_SUPER_CALL_VERIFIED))
				{
					throw new IllegalStateException(Component.class.getName() +
						" has not been properly initialized. Something in the hierarchy of " +
						getClass().getName() +
						" has not called super.onInitialize() in the override of onInitialize() method");
				}
				setRequestFlag(RFLAG_INITIALIZE_SUPER_CALL_VERIFIED, false);
	
				getApplication().getComponentInitializationListeners().onInitialize(this);
			}
			else if (getFlag(FLAG_REMOVED))
			{
				setFlag(FLAG_REMOVED, false);
				setRequestFlag(RFLAG_ON_RE_ADD_SUPER_CALL_VERIFIED, false);
				onReAdd();
				if (!getRequestFlag(RFLAG_ON_RE_ADD_SUPER_CALL_VERIFIED))
				{
					throw new IllegalStateException(Component.class.getName() +
							" has not been properly added. Something in the hierarchy of " +
							getClass().getName() +
							" has not called super.onReAdd() in the override of onReAdd() method");
				}
			}
		} finally {
			HierarchicalContext.pop();
		}
	}

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

View on GitHub (pinned to d44925c47c)

Solutions

  1. Locate the onReAdd() override in the class named in the message or its parents
  2. Call super.onReAdd() inside the override
  3. Avoid removing/re-adding components if not needed; replace child instead

Example fix

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

Strategy: validation

Validate before calling

@Override
protected void onReAdd() {
    assertHasSuperCall(super::onReAdd); // or simply always call super first
    super.onReAdd();
}

Prevention

When it happens

Trigger: A component hierarchy override of onReAdd() does not call super.onReAdd(), and the component is re-added to its parent after having been removed.

Common situations: Custom containers that remove and re-add children dynamically; overridden onReAdd copied from code predating Wicket's super-call verification.

Related errors


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