theonedev/onedev · error · MarkupException

Markup not found. Component:

Error message

Markup not found. Component: 

What it means

internalRenderComponent() re-checks getMarkup() before rendering the component's tag and throws MarkupException (a WicketRuntimeException subclass) when markup is null. This is the check executed during the component render head path; it differs from 1052 only in exception type and timing within the render pipeline.

Source

Thrown at server-core/src/main/java/org/apache/wicket/Component.java:2552

			markupId = getMarkupId();
		}
		return markupId;
	}


	/**
	 * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT.
	 * <p>
	 * Renders the component at the current position in the given markup stream. The method
	 * onComponentTag() is called to allow the component to mutate the start tag. The method
	 * onComponentTagBody() is then called to permit the component to render its body.
	 */
	public final void internalRenderComponent()
	{
		final IMarkupFragment markup = getMarkup();
		if (markup == null)
		{
			throw new MarkupException("Markup not found. Component: " + toString());
		}

		final MarkupStream markupStream = new MarkupStream(markup);

		// Get mutable copy of next tag
		final ComponentTag openTag = markupStream.getTag();
		final ComponentTag tag = openTag.mutable();

		// call application-wide tag listeners
		getApplication().getOnComponentTagListeners().onComponentTag(this, tag);

		// Call any tag handler
		onComponentTag(tag);

		// If we're an openclose tag
		if (!tag.isOpenClose() && !tag.isOpen())
		{
			// We were something other than <tag> or <tag/>

View on GitHub (pinned to d44925c47c)

Solutions

  1. Ensure the component's markup file and wicket:id tag exist as for 1052.
  2. For Ajax targets, verify targeted components are still in the page's component hierarchy.
  3. Restart/redeploy cleanly to flush stale markup caches.
  4. Use IMarkupCache.clear() in dev settings during hot code swaps.
  5. Check custom borders/fragments supply a valid markup provider.

Example fix

// before
fragment = new Fragment("id", "missingFragment", page);
// after
// page.html must contain <wicket:fragment wicket:id="missingFragment">...</wicket:fragment>
fragment = new Fragment("id", "existingFragment", page);
Defensive patterns

Strategy: validation

Validate before calling

if (component.getMarkup() == null) { return; } // skip render, or fix markup

Type guard

boolean renderable(Component c) { return c.getMarkup() != null; }

Try / catch

try { target.add(component); } catch (MarkupException e) { log.error("Ajax target component lost markup: " + component.getId(), e); }

Prevention

When it happens

Trigger: Rendering a component (e.g. during respond phase / header contribution) whose markup is not resolvable: missing HTML file, missing wicket:id tag, Fragment without matching <wicket:fragment>, or component re-rendered after markup detached.

Common situations: Ajax re-render of a component whose markup file was removed; header contributions (renderHead) triggering render for orphan components; Border/Fragment misuse; page reload after hot-redeploy with stale component tree.

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


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/52930ebe265b9dfd. Report an issue: GitHub.