{"record":{"id":"4cf2d4fc5b1cd0c1","repo":"theonedev/onedev","slug":"markup-not-found-for-component","errorCode":null,"errorMessage":"Markup not found for Component: ","messagePattern":"Markup not found for Component: ","errorType":"exception","errorClass":"MarkupNotFoundException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/apache/wicket/Component.java","lineNumber":2389,"sourceCode":"\t\t\tif (exception != null)\n\t\t\t{\n\t\t\t\tthrow exception;\n\t\t\t}\n\t\t} finally {\n\t\t\tHierarchicalContext.pop();\n\t\t}\n\t}\n\n\t/**\n\t * Performs a render of this component as part of a Page level render process.\n\t */\n\tprivate void internalRender()\n\t{\n\t\t// Make sure there is a markup available for the Component\n\t\tIMarkupFragment markup = getMarkup();\n\t\tif (markup == null)\n\t\t{\n\t\t\tthrow new MarkupNotFoundException(\"Markup not found for Component: \" + toString());\n\t\t}\n\n\t\t// MarkupStream is an Iterator for the markup\n\t\tMarkupStream markupStream = new MarkupStream(markup);\n\n\t\t// Flag: we started the render process\n\t\tmarkRendering(true);\n\n\t\tMarkupElement elem = markup.get(0);\n\t\tif (elem instanceof ComponentTag)\n\t\t{\n\t\t\t// Guarantee that the markupStream is set and determineVisibility not yet tested\n\t\t\t// See WICKET-2049\n\t\t\t((ComponentTag)elem).onBeforeRender(this, markupStream);\n\t\t}\n\n\t\t// Determine if component is visible using it's authorization status\n\t\t// and the isVisible property.","sourceCodeStart":2371,"sourceCodeEnd":2407,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/Component.java#L2371-L2407","documentation":"During internalRender() Wicket calls getMarkup() and throws MarkupNotFoundException when the component cannot resolve any markup (no associated markup file, no <wicket:fragment> entry, or component not attached to the markup hierarchy). Every rendered component must have markup available before rendering begins.","triggerScenarios":"Rendering a component whose markup file (Foo.html) is missing or misnamed; a Fragment rendered without add(new Fragment(...)) or with wrong markupId; a Panel placed where no markup tag has its wicket:id; misconfigured markup loading after moving packages; calling component.render() manually outside a page with associated markup.","commonSituations":"HTML file placed in wrong package/resource folder so it's not on the classpath; renamed Java class without renaming the HTML file; markup caching stale after redeploy; adding a component to a page but forgetting the wicket:id in HTML; using Fragment with a markup provider that lacks the fragment id.","solutions":["Verify a markup file (same name as the class, .html) exists next to the component class in the same package.","Check the HTML contains a tag with wicket:id matching the component's getId().","For Fragment, ensure markupProvider's markup contains <wicket:fragment wicket:id=\"...\"> with the right id.","Clear Wicket's markup cache / redeploy so new markup files are picked up (getResourceSettings().setCachingStrategy).","If the component renders itself (e.g. Label via the body), ensure the parent's markup stream still has its tag; check that no code removed the tag from markup."],"exampleFix":"// before\nclass MyPanel extends Panel {} // MyPanel.html missing\n// after\nclass MyPanel extends Panel {} // plus src/main/java/com/app/MyPanel.html with <wicket:panel>...</wicket:panel>","handlingStrategy":"validation","validationCode":"if (component.getMarkup() == null) { throw new AssertionError(\"Missing markup for \" + component.getId() + \"; check Foo.html and wicket:id\"); }","typeGuard":"boolean hasMarkup(Component c) { return c.getMarkup() != null; }","tryCatchPattern":"try { component.render(); } catch (MarkupNotFoundException e) { log.error(\"Check that class-named HTML file exists in same package and has wicket:id \" + component.getId()); }","preventionTips":["Keep HTML files in the same package/path as their component classes","Always add matching wicket:id in markup when adding components in Java","Flush markup cache after redeploys"],"tags":["wicket","markup","rendering"],"backgroundTag":"resource-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}