theonedev/onedev · error · IllegalArgumentException
Component is not a container and so does not contain the pat
Error message
Component is not a container and so does not contain the path
What it means
Component.get(String path) on a non-container component throws IllegalArgumentException when asked for any non-empty path, since a leaf component cannot contain children. Only an empty path (the component itself) is valid.
Source
Thrown at server-core/src/main/java/org/apache/wicket/Component.java:4278
{
}
/**
* Gets the component at the given path.
*
* @param path
* Path to component
* @return The component at the path
*/
@Override
public Component get(final String path)
{
// Path to this component is an empty path
if (path.length() == 0)
{
return this;
}
throw new IllegalArgumentException(
exceptionMessage("Component is not a container and so does not contain the path " +
path));
}
/**
* @param setRenderingFlag
* rendering flag
*/
void internalMarkRendering(boolean setRenderingFlag)
{
// WICKET-5460 no longer prepared for render
setFlag(FLAG_PREPARED_FOR_RENDER, false);
setFlag(FLAG_RENDERING, setRenderingFlag);
}
/**
* @return True if this component or any of its parents is in auto-add modeView on GitHub (pinned to d44925c47c)
Solutions
- Call get() on the correct container ancestor, or use page.get(path) for page-relative paths.
- If the component should contain children, change its type to a container (WebMarkupContainer/Panel/Form).
- Check the returned path/id at runtime; guard with instanceof Container before calling get().
Example fix
// before
Label label = new Label("msg", "hi");
label.get("child"); // IllegalArgumentException
// after
WebMarkupContainer box = new WebMarkupContainer("msg");
box.add(new Label("child", "hi"));
box.get("child"); Defensive patterns
Strategy: type-guard
Validate before calling
Component target = path.isEmpty() ? component : (component instanceof MarkupContainer ? ((MarkupContainer) component).get(path) : null);
Type guard
boolean canGet = component instanceof MarkupContainer || path.isEmpty();
Try / catch
try { component.get(path); } catch (IllegalArgumentException e) { component = component.getPage().get(path); } Prevention
- Use page.get(path) for page-relative lookups instead of guessing the starting component.
- Guard with instanceof MarkupContainer before calling get(path) on non-empty paths.
- Keep wicket:id paths in sync with the component hierarchy during markup refactors.
When it happens
Trigger: Calling component.get("childId") or component.get("a:b") where `component` is a Label/TextField etc. rather than a container (WebMarkupContainer, Form, Panel).
Common situations: Wrong assumptions about component nesting after refactoring markup; using a path built for a different hierarchy level; passing an absolute-ish path to a leaf component instead of calling page.get().
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Unable to find parent with associated markup
- Cannot modify component hierarchy after render phase has sta
- Path '" + blobIdent.path + "' is a tree"
- Job not found (project: %s, commit: %s, job: %s)
- Source and target are the same
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/c74756f9a122072d.
Report an issue: GitHub.