theonedev/onedev · error · MarkupNotFoundException
Markup not found for Component:
Error message
Markup not found for Component:
What it means
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.
Source
Thrown at server-core/src/main/java/org/apache/wicket/Component.java:2389
if (exception != null)
{
throw exception;
}
} finally {
HierarchicalContext.pop();
}
}
/**
* Performs a render of this component as part of a Page level render process.
*/
private void internalRender()
{
// Make sure there is a markup available for the Component
IMarkupFragment markup = getMarkup();
if (markup == null)
{
throw new MarkupNotFoundException("Markup not found for Component: " + toString());
}
// MarkupStream is an Iterator for the markup
MarkupStream markupStream = new MarkupStream(markup);
// Flag: we started the render process
markRendering(true);
MarkupElement elem = markup.get(0);
if (elem instanceof ComponentTag)
{
// Guarantee that the markupStream is set and determineVisibility not yet tested
// See WICKET-2049
((ComponentTag)elem).onBeforeRender(this, markupStream);
}
// Determine if component is visible using it's authorization status
// and the isVisible property.View on GitHub (pinned to d44925c47c)
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.
Example fix
// before
class MyPanel extends Panel {} // MyPanel.html missing
// after
class MyPanel extends Panel {} // plus src/main/java/com/app/MyPanel.html with <wicket:panel>...</wicket:panel> Defensive patterns
Strategy: validation
Validate before calling
if (component.getMarkup() == null) { throw new AssertionError("Missing markup for " + component.getId() + "; check Foo.html and wicket:id"); } Type guard
boolean hasMarkup(Component c) { return c.getMarkup() != null; } Try / catch
try { component.render(); } catch (MarkupNotFoundException e) { log.error("Check that class-named HTML file exists in same package and has wicket:id " + component.getId()); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Markup not found. Component:
- Markup id set on a component that is usually not rendered in
- Placeholder tag set on a component that is usually not rende
- Cannot determine Markup. Component is not yet connected to a
- has not been properly detached. Something in the hierarchy
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/4cf2d4fc5b1cd0c1.
Report an issue: GitHub.