{"record":{"id":"c74756f9a122072d","repo":"theonedev/onedev","slug":"component-is-not-a-container-and-so-does-not-conta","errorCode":null,"errorMessage":"Component is not a container and so does not contain the path ","messagePattern":"Component is not a container and so does not contain the path ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/apache/wicket/Component.java","lineNumber":4278,"sourceCode":"\t{\n\t}\n\n\t/**\n\t * Gets the component at the given path.\n\t * \n\t * @param path\n\t *            Path to component\n\t * @return The component at the path\n\t */\n\t@Override\n\tpublic Component get(final String path)\n\t{\n\t\t// Path to this component is an empty path\n\t\tif (path.length() == 0)\n\t\t{\n\t\t\treturn this;\n\t\t}\n\t\tthrow new IllegalArgumentException(\n\t\t\texceptionMessage(\"Component is not a container and so does not contain the path \" +\n\t\t\t\tpath));\n\t}\n\n\t/**\n\t * @param setRenderingFlag\n\t *            rendering flag\n\t */\n\tvoid internalMarkRendering(boolean setRenderingFlag)\n\t{\n\t\t// WICKET-5460 no longer prepared for render\n\t\tsetFlag(FLAG_PREPARED_FOR_RENDER, false);\n\n\t\tsetFlag(FLAG_RENDERING, setRenderingFlag);\n\t}\n\n\t/**\n\t * @return True if this component or any of its parents is in auto-add mode","sourceCodeStart":4260,"sourceCodeEnd":4296,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/Component.java#L4260-L4296","documentation":"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.","triggerScenarios":"Calling component.get(\"childId\") or component.get(\"a:b\") where `component` is a Label/TextField etc. rather than a container (WebMarkupContainer, Form, Panel).","commonSituations":"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().","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()."],"exampleFix":"// before\nLabel label = new Label(\"msg\", \"hi\");\nlabel.get(\"child\"); // IllegalArgumentException\n// after\nWebMarkupContainer box = new WebMarkupContainer(\"msg\");\nbox.add(new Label(\"child\", \"hi\"));\nbox.get(\"child\");","handlingStrategy":"type-guard","validationCode":"Component target = path.isEmpty() ? component : (component instanceof MarkupContainer ? ((MarkupContainer) component).get(path) : null);","typeGuard":"boolean canGet = component instanceof MarkupContainer || path.isEmpty();","tryCatchPattern":"try { component.get(path); } catch (IllegalArgumentException e) { component = component.getPage().get(path); }","preventionTips":["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."],"tags":["wicket","hierarchy","invalid-argument","container"],"backgroundTag":"invalid-argument-value","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"}