{"record":{"id":"ea49d1c159b55e11","repo":"theonedev/onedev","slug":"placeholder-tag-set-on-a-component-that-renders-it","errorCode":null,"errorMessage":"Placeholder tag set on a component that renders its body only. Component id: %s.","messagePattern":"Placeholder tag set on a component that renders its body only\\. Component id: (.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/apache/wicket/Component.java","lineNumber":2608,"sourceCode":"\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}\n\t\t\tmarkupStream.next();\n\n\t\t\t// Render the body only if open-body-close. Do not render if open-close.\n\t\t\tif (tag.isOpen())\n\t\t\t{\n\t\t\t\t// Render the body. The default strategy will simply call the component's\n\t\t\t\t// onComponentTagBody() implementation.\n\t\t\t\tgetMarkupSourcingStrategy().onComponentTagBody(this, markupStream, tag);\n\n\t\t\t\t// Render close tag","sourceCodeStart":2590,"sourceCodeEnd":2626,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/Component.java#L2590-L2626","documentation":"A component that renders only its body (no own tag) had setOutputMarkupPlaceholderTag / FLAG_PLACEHOLDER set, which cannot work without a tag to render the placeholder into. As with the markup-id case, behavior is governed by NotRenderableErrorStrategy: throw IllegalStateException or log a warning.","triggerScenarios":"Calling setOutputMarkupPlaceholderTag(true) on a component with renderBodyOnly=true, then rendering it; strict error strategy configured in Application's ExceptionSettings.","commonSituations":"Global Ajax-refresh setup code applying setOutputMarkupPlaceholderTag(true) to all children; inline fields/text fields configured body-only; strict strategy enabled for catching Ajax mistakes early.","solutions":["Remove setOutputMarkupPlaceholderTag(true) for body-only components.","Set renderBodyOnly(false) so the placeholder tag can be rendered.","Relax NotRenderableErrorStrategy if the placeholder is irrelevant.","Only apply placeholders to components intended for Ajax replacement.","Audit base classes/helpers that bulk-enable output flags."],"exampleFix":"// before\nfield.setRenderBodyOnly(true);\nfield.setOutputMarkupPlaceholderTag(true);\n// after\nfield.setRenderBodyOnly(false);\nfield.setOutputMarkupPlaceholderTag(true);","handlingStrategy":"validation","validationCode":"if (component.isRenderBodyOnly() && component.getOutputMarkupPlaceholderTag()) { component.setOutputMarkupPlaceholderTag(false); }","typeGuard":"boolean canHavePlaceholder(Component c) { return !c.isRenderBodyOnly(); }","tryCatchPattern":"try { renderComponent(c); } catch (IllegalStateException e) { if (e.getMessage().contains(\"Placeholder tag\")) { log.warn(e.getMessage()); } else { throw e; } }","preventionTips":["Apply setOutputMarkupPlaceholderTag only to components you Ajax-replace","Avoid bulk flag-enable helpers over body-only components","Render the component tag when a placeholder is required"],"tags":["wicket","rendering","placeholder","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"}