{"record":{"id":"9b94482701d4166e","repo":"theonedev/onedev","slug":"has-not-been-properly-removed-from-hierachy-some","errorCode":null,"errorMessage":" has not been properly removed from hierachy. Something in the hierarchy of ","messagePattern":" has not been properly removed from hierachy\\. Something in the hierarchy of ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/apache/wicket/Component.java","lineNumber":1157,"sourceCode":"\t *            The feedback message\n\t */\n\tpublic final void debug(final Serializable message)\n\t{\n\t\tgetFeedbackMessages().debug(this, message);\n\t\taddStateChange();\n\t}\n\n\t/**\n\t * Signals this Component that it is removed from the Component hierarchy.\n\t */\n\tfinal void internalOnRemove()\n\t{\n\t\tsetFlag(FLAG_REMOVING_FROM_HIERARCHY, true);\n\t\tonRemove();\n\t\tsetFlag(FLAG_REMOVED, true);\n\t\tif (getFlag(FLAG_REMOVING_FROM_HIERARCHY))\n\t\t{\n\t\t\tthrow new IllegalStateException(Component.class.getName() +\n\t\t\t\t\" has not been properly removed from hierachy. Something in the hierarchy of \" +\n\t\t\t\tgetClass().getName() +\n\t\t\t\t\" has not called super.onRemove() in the override of onRemove() method\");\n\t\t}\n\t\tnew Behaviors(this).onRemove(this);\n\t\tremoveChildren();\n\t}\n\n\t/**\n\t * Detaches the component. This is called at the end of the request for all the pages that are\n\t * touched in that request.\n\t */\n\t@Override\n\tpublic final void detach()\n\t{\n\t\ttry\n\t\t{\n\t\t\tsetFlag(FLAG_DETACHING, true);","sourceCodeStart":1139,"sourceCodeEnd":1175,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/Component.java#L1139-L1175","documentation":"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).","triggerScenarios":"An override of onRemove() omits super.onRemove(); the component is removed via remove() or parent removal.","commonSituations":"Custom containers releasing resources in onRemove(); overrides copied from pre-6.x Wicket code.","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)"],"exampleFix":"// before\n@Override\nprotected void onRemove() {\n    releaseResources();\n}\n// after\n@Override\nprotected void onRemove() {\n    try {\n        releaseResources();\n    } finally {\n        super.onRemove();\n    }\n}","handlingStrategy":"validation","validationCode":"@Override\nprotected void onRemove() {\n    try {\n        release();\n    } finally {\n        super.onRemove();\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use try/finally so exceptions in your code cannot skip super.onRemove()","Review removal logic when upgrading Wicket versions"],"tags":["wicket","lifecycle","component-removal"],"backgroundTag":"method-not-implemented","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}