theonedev/onedev · error · ExplicitException

Getter not found for property: ${dependsOn.property()}

Error message

Getter not found for property: ${dependsOn.property()}

What it means

Variant of the getter-not-found error: the constrained property's getter exists, but a @DependsOn annotation on it references another property whose getter cannot be found on the bean class. OneDev needs the dependency getter to evaluate whether the constrained property should be visible/validated.

Source

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

		var location = metaConstraint.getLocation();
		if (location instanceof TypeArgumentConstraintLocation) {
			location = ((TypeArgumentConstraintLocation) location).getOuterDelegate();
		}		
		if (location instanceof AbstractPropertyConstraintLocation && valueContext.getCurrentBean() != null) {
			// Check if this constraint comes from a superclass method that has been overridden
			if (isConstraintFromOverriddenMethod(location, valueContext.getCurrentBean().getClass(), metaConstraint.getDescriptor().getAnnotationType())) {
				return false; // Skip validation for constraints from overridden superclass methods
			}
			var bean = valueContext.getCurrentBean();			
			var propertyName = ((AbstractPropertyConstraintLocation<?>) location).getPropertyName();
			var getter = BeanUtils.findGetter(bean.getClass(), propertyName);
			if (getter == null) {
				throw new ExplicitException("Getter not found for property: " + propertyName);
			}
			for (var dependsOn : getter.getAnnotationsByType(DependsOn.class)) {
				var dependencyGetter = BeanUtils.findGetter(bean.getClass(), dependsOn.property());
				if (dependencyGetter == null) {
					throw new ExplicitException("Getter not found for property: " + dependsOn.property());
				}
				try {
					var dependencyPropertyValue = dependencyGetter.invoke(bean);
					if (!DependsOnUtils.isPropertyVisible(dependsOn, dependencyGetter.getReturnType(), dependencyPropertyValue))
						return false;
				} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
					throw new ExplicitException("Error invoking getter for property: " + dependsOn.property(), e);
				}
			}
			var showCondition = getter.getAnnotation(ShowCondition.class);
			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)) {

View on GitHub (pinned to d44925c47c)

Solutions

  1. Correct the property name in @DependsOn to reference an existing getter.
  2. Add the missing getter for the referenced property.
  3. Remove the stale @DependsOn if the dependency property no longer exists.

Example fix

// before
@DependsOn(property = "enabeld") // typo
public Boolean isVerbose() { return verbose; }

// after
@DependsOn(property = "enabled")
public Boolean isVerbose() { return verbose; }
Defensive patterns

Strategy: type-guard

Validate before calling

for (DependsOn d : getter.getAnnotationsByType(DependsOn.class)) {
    if (BeanUtils.findGetter(beanClass, d.property()) == null)
        throw new IllegalStateException("@DependsOn references missing getter: " + d.property());
}

Type guard

static boolean dependsOnPropertiesExist(Class<?> type) {
    for (Method m : type.getMethods()) {
        for (DependsOn d : m.getAnnotationsByType(DependsOn.class)) {
            String cap = Character.toUpperCase(d.property().charAt(0)) + d.property().substring(1);
            try { type.getMethod("get" + cap); }
            catch (NoSuchMethodException e) { return false; }
        }
    }
    return true;
}

Try / catch

try {
    validator.validate(bean);
} catch (Exception e) {
    if (e.getMessage() != null && e.getMessage().contains("Getter not found")) {
        // fix @DependsOn property name or add the referenced getter
    } else throw e;
}

Prevention

When it happens

Trigger: A getter annotated @DependsOn(property="x") where the bean has no getter for 'x' — typically a typo in the dependsOn property name, a renamed/deleted dependency property, or a dependency field lacking a getter.

Common situations: OneDev settings/input forms using conditional properties, refactoring property names without updating @DependsOn references, boolean dependency properties using wrong accessor prefix.

Related errors


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