{"record":{"id":"8a98691281abeb86","repo":"theonedev/onedev","slug":"markup-id-set-on-a-component-that-renders-its-body","errorCode":null,"errorMessage":"Markup id set on a component that renders its body only. Markup id: %s, component id: %s.","messagePattern":"Markup id set on a component that renders its body only\\. Markup id: (.+?), component id: (.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/apache/wicket/Component.java","lineNumber":2598,"sourceCode":"\t\ttry\n\t\t{\n\t\t\t// Render open tag\n\t\t\tboolean renderBodyOnly = getRenderBodyOnly();\n\t\t\tif (renderBodyOnly)\n\t\t\t{\n\t\t\t\tExceptionSettings.NotRenderableErrorStrategy notRenderableErrorStrategy = ExceptionSettings.NotRenderableErrorStrategy.LOG_WARNING;\n\t\t\t\tif (Application.exists())\n\t\t\t\t{\n\t\t\t\t\tnotRenderableErrorStrategy = getApplication().getExceptionSettings().getNotRenderableErrorStrategy();\n\t\t\t\t}\n\n\t\t\t\tif (getFlag(FLAG_OUTPUT_MARKUP_ID))\n\t\t\t\t{\n\t\t\t\t\tString message = String.format(\"Markup id set on a component that renders its body only. \" +\n\t\t\t\t\t                               \"Markup id: %s, component id: %s.\", getMarkupId(), getId());\n\t\t\t\t\tif (notRenderableErrorStrategy == ExceptionSettings.NotRenderableErrorStrategy.THROW_EXCEPTION)\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new IllegalStateException(message);\n\t\t\t\t\t}\n\t\t\t\t\tlog.warn(message);\n\t\t\t\t}\n\t\t\t\tif (getFlag(FLAG_PLACEHOLDER))\n\t\t\t\t{\n\t\t\t\t\tString message = String.format(\"Placeholder tag set on a component that renders its body only. \" +\n\t\t\t\t\t                               \"Component id: %s.\", getId());\n\t\t\t\t\tif (notRenderableErrorStrategy == ExceptionSettings.NotRenderableErrorStrategy.THROW_EXCEPTION)\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new IllegalStateException(message);\n\t\t\t\t\t}\n\t\t\t\t\tlog.warn(message);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\trenderComponentTag(tag);\n\t\t\t}","sourceCodeStart":2580,"sourceCodeEnd":2616,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/Component.java#L2580-L2616","documentation":"A component that renders only its body (not its own tag) was flagged with setOutputMarkupId(true), which is meaningless and likely a mistake because there is no tag to attach the id to. Depending on ExceptionSettings.NotRenderableErrorStrategy, Wicket either throws IllegalStateException or logs a warning.","triggerScenarios":"Calling setOutputMarkupId(true) on components whose renderBodyOnly flag is set (or whose markup is set to not render the tag), then rendering; configuring NotRenderableErrorStrategy.THROW_EXCEPTION makes this fatal.","commonSituations":"Setting outputMarkupId globally for Ajax updates while some components are render-body-only; using InlinePanel/transparent containers with outputMarkupId; strategy configured to THROW_EXCEPTION in Application.init for strictness.","solutions":["Don't call setOutputMarkupId(true) on render-body-only components; render their tag instead (setRenderBodyOnly(false)).","If Ajax-updating is needed, allow the tag to render so an id exists.","Change NotRenderableErrorStrategy to LOG_ERROR/WARN if the warning is acceptable.","Guard: `if (!c.isRenderBodyOnly()) c.setOutputMarkupId(true);`.","Or setOutputMarkupPlaceholderTag(true) if you need a tag placeholder for Ajax."],"exampleFix":"// before\nlabel.setRenderBodyOnly(true);\nlabel.setOutputMarkupId(true); // body-only: no tag for the id\n// after\nlabel.setRenderBodyOnly(false);\nlabel.setOutputMarkupId(true); // tag now rendered with the markup id","handlingStrategy":"validation","validationCode":"if (component.isRenderBodyOnly() && component.getFlag(Component.FLAG_OUTPUT_MARKUP_ID)) { log.warn(\"outputMarkupId on body-only component \" + component.getId()); }","typeGuard":"boolean canHaveMarkupId(Component c) { return !c.isRenderBodyOnly() || c.getOutputMarkupPlaceholderTag(); }","tryCatchPattern":"try { renderComponent(c); } catch (IllegalStateException e) { if (e.getMessage().contains(\"renders its body only\")) { log.warn(e.getMessage()); } else { throw e; } }","preventionTips":["Only call setOutputMarkupId(true) on tag-rendering components","Centralize Ajax flag setup in a helper that checks renderBodyOnly","Know your NotRenderableErrorStrategy setting"],"tags":["wicket","rendering","markup-id","ajax"],"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-14T00:17:10.932Z"}