{"record":{"id":"b4bc2e3fadf4444d","repo":"theonedev/onedev","slug":"error-invoking-getter-for-property-name","errorCode":null,"errorMessage":"Error invoking getter for property: ${name}","messagePattern":"Error invoking getter for property: (.+?)","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java","lineNumber":1384,"sourceCode":"\t\t\tif (showCondition != null) {\n\t\t\t\tEditContext.push(new EditContext() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Object getInputValue(String name) {\n\t\t\t\t\t\tvar getter =  BeanUtils.findGetter(bean.getClass(), name);\n\t\t\t\t\t\tif (getter == null) {\n\t\t\t\t\t\t\tfor (var eachGetter: BeanUtils.findGetters(bean.getClass())) {\n\t\t\t\t\t\t\t\tif (EditableUtils.getDisplayName(eachGetter).equals(name)) {\n\t\t\t\t\t\t\t\t\tgetter = eachGetter;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (getter == null) \n\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Getter not found for property: \" + name);\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn getter.invoke(bean);\n\t\t\t\t\t\t} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {\n\t\t\t\t\t\t\tthrow new ExplicitException(\"Error invoking getter for property: \" + name, e);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttry {\n\t\t\t\t\tif (!(boolean)ReflectionUtils.invokeStaticMethod(bean.getClass(), showCondition.value()))\n\t\t\t\t\t\treturn false;\n\t\t\t\t} finally {\n\t\t\t\t\tEditContext.pop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t\t// check if this validation context is qualified to validate the current meta constraint.\n\t\t// For instance, in the case of validateProperty()/validateValue(), the current meta constraint\n\t\t// could be for another property and, in this case, we don't validate it.\n\t\tif ( !validationContext.appliesTo( metaConstraint ) ) {\n\t\t\treturn false;\n\t\t}","sourceCodeStart":1366,"sourceCodeEnd":1402,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java#L1366-L1402","documentation":"After locating a getter for a ShowCondition-referenced property, OneDev invokes it reflectively on the bean being validated. If the invocation fails with IllegalAccessException, IllegalArgumentException, or the getter itself throws (InvocationTargetException), it is wrapped in this ExplicitException with the original cause attached.","triggerScenarios":"EditContext.getInputValue finds a getter for a @ShowCondition-referenced property but getter.invoke(bean) throws — e.g. the getter throws NPE/IAE on uninitialized state, or the getter is not accessible on the actual runtime bean class.","commonSituations":"A getter that dereferences a null dependency or assumes an already-initialized field; a getter that throws IllegalStateException when the bean is only partially populated during form validation; SDK/framework changes making the method inaccessible.","solutions":["Inspect the cause stack trace (wrapped in the ExplicitException) to find the real exception thrown inside the getter.","Make the getter null-safe so it does not throw on partially initialized bean state.","Verify the getter has no side effects and works for all intermediate bean states used in the form.","Rebuild and hot-reload the fixed class via ./dev.sh build."],"exampleFix":"// before\npublic String getRegion() { return country.getRegion().getName(); }\n// after\npublic String getRegion() { return country != null && country.getRegion() != null ? country.getRegion().getName() : null; }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Object value = getter.invoke(bean);\n} catch (InvocationTargetException e) {\n    logger.error(\"Getter for property threw\", e.getTargetException()); // fix the getter based on the real cause\n}","preventionTips":["Keep getters pure, side-effect free and null-safe","Never perform lookups or I/O inside getters used by ShowCondition","Test forms with partially initialized bean states"],"tags":["reflection","bean-validation","getter-invocation"],"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"}