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
- Locate the onReAdd() override in the class named in the message or its parents
- Call super.onReAdd() inside the override
- 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
- Call super.onReAdd() first in any override
- Prefer replacing children over remove/re-add cycles
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
- Cannot determine Markup. Component is not yet connected to a
- has not been properly initialized. Something in the hierarc
- has not been properly detached. Something in the hierarchy
- has not been properly rendered. Something in the hierarchy
- has not been properly removed from hierachy. Something in t
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/69109de714ae9c9d.
Report an issue: GitHub.