theonedev/onedev · error · IllegalStateException
has not been properly removed from hierachy. Something in t
Error message
has not been properly removed from hierachy. Something in the hierarchy of
What it means
When a component is removed from its hierarchy, Component calls onRemove() and then verifies FLAG_REMOVING_FROM_HIERARCHY was cleared; the clear happens only in Component.onRemove(). If an override does not call super.onRemove(), the flag stays set and Wicket throws this IllegalStateException (note the 'hierachy' typo is in the framework message itself).
Source
Thrown at server-core/src/main/java/org/apache/wicket/Component.java:1157
* The feedback message
*/
public final void debug(final Serializable message)
{
getFeedbackMessages().debug(this, message);
addStateChange();
}
/**
* Signals this Component that it is removed from the Component hierarchy.
*/
final void internalOnRemove()
{
setFlag(FLAG_REMOVING_FROM_HIERARCHY, true);
onRemove();
setFlag(FLAG_REMOVED, true);
if (getFlag(FLAG_REMOVING_FROM_HIERARCHY))
{
throw new IllegalStateException(Component.class.getName() +
" has not been properly removed from hierachy. Something in the hierarchy of " +
getClass().getName() +
" has not called super.onRemove() in the override of onRemove() method");
}
new Behaviors(this).onRemove(this);
removeChildren();
}
/**
* Detaches the component. This is called at the end of the request for all the pages that are
* touched in that request.
*/
@Override
public final void detach()
{
try
{
setFlag(FLAG_DETACHING, true);View on GitHub (pinned to d44925c47c)
Solutions
- Find the onRemove() override in the named hierarchy
- Add super.onRemove() to the override
- Ensure no exception thrown in the override body prevents the super call (use try/finally if needed)
Example fix
// before
@Override
protected void onRemove() {
releaseResources();
}
// after
@Override
protected void onRemove() {
try {
releaseResources();
} finally {
super.onRemove();
}
} Defensive patterns
Strategy: validation
Validate before calling
@Override
protected void onRemove() {
try {
release();
} finally {
super.onRemove();
}
} Prevention
- Use try/finally so exceptions in your code cannot skip super.onRemove()
- Review removal logic when upgrading Wicket versions
When it happens
Trigger: An override of onRemove() omits super.onRemove(); the component is removed via remove() or parent removal.
Common situations: Custom containers releasing resources in onRemove(); overrides copied from pre-6.x Wicket code.
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 added. Something in the hierarchy of
- has not been properly detached. Something in the hierarchy
- has not been properly rendered. Something in the hierarchy
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/9b94482701d4166e.
Report an issue: GitHub.