{"record":{"id":"c787bab74d49d8bc","repo":"theonedev/onedev","slug":"cannot-determine-markup-component-is-not-yet-conn","errorCode":null,"errorMessage":"Cannot determine Markup. Component is not yet connected to a parent. ","messagePattern":"Cannot determine Markup\\. Component is not yet connected to a parent\\. ","errorType":"exception","errorClass":"MarkupNotFoundException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/apache/wicket/Component.java","lineNumber":753,"sourceCode":"\t\t}\n\n\t\t// No parent, than check associated markup files\n\t\tif (parent == null)\n\t\t{\n\t\t\t// Must be a MarkupContainer to have associated markup file\n\t\t\tif (this instanceof MarkupContainer)\n\t\t\t{\n\t\t\t\tMarkupContainer container = (MarkupContainer)this;\n\t\t\t\tMarkup associatedMarkup = container.getAssociatedMarkup();\n\t\t\t\tif (associatedMarkup != null)\n\t\t\t\t{\n\t\t\t\t\tmarkup = associatedMarkup;\n\t\t\t\t\treturn markup;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Don't know how to find the markup\n\t\t\tthrow new MarkupNotFoundException(\n\t\t\t\t\"Cannot determine Markup. Component is not yet connected to a parent. \" +\n\t\t\t\t\ttoString());\n\t\t}\n\n\t\t// Ask the parent for find the markup for me\n\t\tmarkup = parent.getMarkup(this);\n\t\treturn markup;\n\t}\n\n\t/**\n\t * @return The 'id' attribute from the associated markup tag\n\t */\n\tpublic final String getMarkupIdFromMarkup()\n\t{\n\t\tComponentTag tag = getMarkupTag();\n\t\tif (tag != null)\n\t\t{\n\t\t\tString id = tag.getAttribute(\"id\");","sourceCodeStart":735,"sourceCodeEnd":771,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/Component.java#L735-L771","documentation":"Wicket's Component.getMarkup() throws MarkupNotFoundException when a component needs its markup but is not yet attached to a parent and has no associated markup source of its own. Wicket resolves markup via the component hierarchy; an orphan component (never added to a page/panel) cannot be resolved. Thrown typically during render or toString of such a component.","triggerScenarios":"Rendering (or calling toString()/markup-related helpers on) a component that was constructed but never added to a parent container; renderHead/renderComponentTag called outside the normal render cycle; component removed from hierarchy before render.","commonSituations":"Forgetting page.add(component) or list item reuse after removal; calling component.render() manually instead of adding it; using a component in a callback after the page structure changed; Ajax target referencing a detached component.","solutions":["Add the component to a parent (page/panel/border) before rendering.","Check lifecycle: only render components during Wicket's request/render cycle.","For Ajax targets, re-add the parent container rather than a detached child.","Inspect the toString() payload in the message to identify the orphan component class and id."],"exampleFix":"// before\nLabel label = new Label(\"msg\", \"hello\");\nlabel.toString(); // MarkupNotFoundException: not connected to parent\n// after\nadd(new Label(\"msg\", \"hello\"));","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Java\npublic static boolean isAttachedToHierarchy(Component c) {\n    return c.getParent() != null || c instanceof Page;\n}","tryCatchPattern":"try { component.render(); } catch (MarkupNotFoundException e) { log.warn(\"Component {} not attached to hierarchy\", component.getId()); }","preventionTips":["Always add() components to a page/panel before any render or toString use","Avoid manual component.render(); rely on Wicket's render cycle","Re-add parent containers instead of detached children in Ajax targets","Review component removal/replacement logic for orphaned instances"],"tags":["wicket","component","lifecycle","markup"],"backgroundTag":"invalid-state-transition","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"}