{"record":{"id":"63968d67d713a5fe","repo":"theonedev/onedev","slug":"exception-in-rendering-component","errorCode":null,"errorMessage":"Exception in rendering component: ","messagePattern":"Exception in rendering component: ","errorType":"exception","errorClass":"WicketRuntimeException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/apache/wicket/Component.java","lineNumber":2648,"sourceCode":"\t\t\t\t}\n\t\t\t\telse if (renderBodyOnly == false)\n\t\t\t\t{\n\t\t\t\t\tif (needToRenderTag(openTag))\n\t\t\t\t\t{\n\t\t\t\t\t\t// Close the manually opened tag. And since the user might have changed the\n\t\t\t\t\t\t// tag name ...\n\t\t\t\t\t\tgetResponse().write(tag.syntheticCloseTagString());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch (WicketRuntimeException wre)\n\t\t{\n\t\t\tthrow wre;\n\t\t}\n\t\tcatch (RuntimeException re)\n\t\t{\n\t\t\tthrow new WicketRuntimeException(\"Exception in rendering component: \" + this, re);\n\t\t}\n\t}\n\n\t/**\n\t * \n\t * @param openTag\n\t * @return true, if the tag shall be rendered\n\t */\n\tprivate boolean needToRenderTag(final ComponentTag openTag)\n\t{\n\t\t// If a open-close tag has been modified to be open-body-close then a\n\t\t// synthetic close tag must be rendered.\n\t\tboolean renderTag = (openTag != null && !(openTag instanceof WicketTag));\n\t\tif (renderTag == false)\n\t\t{\n\t\t\trenderTag = !getApplication().getMarkupSettings().getStripWicketTags();\n\t\t}\n\t\treturn renderTag;","sourceCodeStart":2630,"sourceCodeEnd":2666,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/Component.java#L2630-L2666","documentation":"Component.render() catches any RuntimeException thrown during rendering that is not already a WicketRuntimeException and wraps it in a new WicketRuntimeException with the message 'Exception in rendering component: <this>' and the original as the cause. This is a diagnostic wrapper — the real fault is in the cause.","triggerScenarios":"Any RuntimeException thrown from onRender/onComponentRender/onRenderHead, model.getObject() failures during render, NPEs in custom render logic, converter errors — anything thrown inside the component render pipeline.","commonSituations":"Null model object dereferenced in onBeforeRender; custom panels throwing in their render override; database exceptions during model loading mid-render surfacing wrapped as this error; serialization issues during render.","solutions":["Inspect the wrapped cause (getCause()) — fix that exception, not the wrapper.","Check the component's model loads null-safely (LoadableDetachableModel.load handling missing data).","Wrap risky rendering logic in try/catch or use IErrorMessageReporter feedback panels.","Log the full stack trace with the component's page path to locate the failing component.","Reproduce with WicketTester to get a tighter stack."],"exampleFix":"// before\nprotected void onRender() { data.get(0).render(); } // NPE when data empty\n// after\nprotected void onRender() {\n    if (data == null || data.isEmpty()) { setVisible(false); return; }\n    data.get(0).render();\n}","handlingStrategy":"try-catch","validationCode":"try { model.getObject(); } catch (RuntimeException e) { log.error(\"Model load will fail render\", e); }","typeGuard":"boolean safelyRenderable(Component c) { try { return c.getDefaultModel() == null || c.getDefaultModelObject() != null; } catch (RuntimeException e) { return false; } }","tryCatchPattern":"try { component.render(); } catch (WicketRuntimeException e) { Throwable cause = e.getCause(); log.error(\"Real failure rendering \" + component.getId(), cause); }","preventionTips":["Always inspect getCause(); the message names the component but the cause is the bug","Null-check model objects in onBeforeRender","Add feedback-panel error handling around fragile renders"],"tags":["wicket","rendering","wrapper","runtime-exception"],"backgroundTag":"internal-invariant-violation","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"}