theonedev/onedev · error · ExplicitException

Error invoking getter for property: ${name}

Error message

Error invoking getter for property: ${name}

What it means

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.

Source

Thrown at server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java:1384

			if (showCondition != null) {
				EditContext.push(new EditContext() {
					@Override
					public Object getInputValue(String name) {
						var getter =  BeanUtils.findGetter(bean.getClass(), name);
						if (getter == null) {
							for (var eachGetter: BeanUtils.findGetters(bean.getClass())) {
								if (EditableUtils.getDisplayName(eachGetter).equals(name)) {
									getter = eachGetter;
									break;
								}
							}
							if (getter == null) 
								throw new ExplicitException("Getter not found for property: " + name);
						}
						try {
							return getter.invoke(bean);
						} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
							throw new ExplicitException("Error invoking getter for property: " + name, e);
						}
					}
				});
				try {
					if (!(boolean)ReflectionUtils.invokeStaticMethod(bean.getClass(), showCondition.value()))
						return false;
				} finally {
					EditContext.pop();
				}
			}
		}
				
		// check if this validation context is qualified to validate the current meta constraint.
		// For instance, in the case of validateProperty()/validateValue(), the current meta constraint
		// could be for another property and, in this case, we don't validate it.
		if ( !validationContext.appliesTo( metaConstraint ) ) {
			return false;
		}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Inspect the cause stack trace (wrapped in the ExplicitException) to find the real exception thrown inside the getter.
  2. Make the getter null-safe so it does not throw on partially initialized bean state.
  3. Verify the getter has no side effects and works for all intermediate bean states used in the form.
  4. Rebuild and hot-reload the fixed class via ./dev.sh build.

Example fix

// before
public String getRegion() { return country.getRegion().getName(); }
// after
public String getRegion() { return country != null && country.getRegion() != null ? country.getRegion().getName() : null; }
Defensive patterns

Strategy: try-catch

Try / catch

try {
    Object value = getter.invoke(bean);
} catch (InvocationTargetException e) {
    logger.error("Getter for property threw", e.getTargetException()); // fix the getter based on the real cause
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/b4bc2e3fadf4444d. Report an issue: GitHub.