theonedev/onedev · error · IllegalArgumentException
Invalid property path: {path}.
Error message
Invalid property path: {path}. What it means
Thrown by validateProperty/validateValue when the given PropertyPath references an intermediate (non-leaf) property that is not cascading (@Valid), so validation cannot traverse through it. Only the final path segment may be a non-cascading property; every earlier segment must be @Valid to descend into it.
Source
Thrown at server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java:1217
* the given property path.
*/
private <V> BeanValueContext<?, V> getValueContextForPropertyValidation(BaseBeanValidationContext<?> validationContext, PathImpl propertyPath) {
Class<?> clazz = validationContext.getRootBeanClass();
BeanMetaData<?> beanMetaData = validationContext.getRootBeanMetaData();
Object value = validationContext.getRootBean();
PropertyMetaData propertyMetaData = null;
Iterator<Path.Node> propertyPathIter = propertyPath.iterator();
while ( propertyPathIter.hasNext() ) {
// cast is ok, since we are dealing with engine internal classes
NodeImpl propertyPathNode = (NodeImpl) propertyPathIter.next();
propertyMetaData = getBeanPropertyMetaData( beanMetaData, propertyPathNode );
// if the property is not the leaf property, we set up the context for the next iteration
if ( propertyPathIter.hasNext() ) {
if ( !propertyMetaData.isCascading() ) {
throw LOG.getInvalidPropertyPathException( validationContext.getRootBeanClass(), propertyPath.asString() );
}
value = getCascadableValue( validationContext, value, propertyMetaData.getCascadables().iterator().next() );
if ( value == null ) {
throw LOG.getUnableToReachPropertyToValidateException( validationContext.getRootBean(), propertyPath );
}
clazz = value.getClass();
// if we are in the case of an iterable and we want to validate an element of this iterable, we have to get the
// element value
if ( propertyPathNode.isIterable() ) {
propertyPathNode = (NodeImpl) propertyPathIter.next();
if ( propertyPathNode.getIndex() != null ) {
value = ReflectionHelper.getIndexedValue( value, propertyPathNode.getIndex() );
}
else if ( propertyPathNode.getKey() != null ) {
value = ReflectionHelper.getMappedValue( value, propertyPathNode.getKey() );View on GitHub (pinned to d44925c47c)
Solutions
- Annotate the intermediate property with @Valid so the path can cascade through it.
- Shorten the path to only reference cascading properties, or validate the nested object separately.
- Check the path string for typos against actual property names.
Example fix
// before
class Order { Address address; } // no @Valid
validator.validateProperty(order, "address.street");
// after
class Order { @Valid Address address; }
validator.validateProperty(order, "address.street"); Defensive patterns
Strategy: validation
Validate before calling
// every segment except the last must be cascading
boolean pathTraversable(Class<?> root, String path) {
String[] segs = path.split("\\.");
Class<?> cur = root;
for (int i = 0; i < segs.length - 1; i++) {
try {
Field f = cur.getDeclaredField(segs[i]);
if (!f.isAnnotationPresent(Valid.class)) return false;
cur = f.getType();
} catch (NoSuchFieldException e) { return false; }
}
return true;
} Type guard
null
Try / catch
try {
validator.validateProperty(bean, path);
} catch (ValidationException e) {
if (e.getMessage().startsWith("Invalid property path")) {
// add @Valid to intermediate property or shorten the path
} else throw e;
} Prevention
- Annotate @Valid on every property you navigate through in multi-segment paths.
- Verify path strings against actual getter/field names before calling validateProperty.
- Validate the nested object directly instead of deep paths when unsure.
When it happens
Trigger: Calling validator.validateProperty(bean, "address.street") where the intermediate 'address' property lacks @Valid, or the path contains a typo so the resolved property has no cascading metadata.
Common situations: Deep property paths in programmatic validation, renamed/removed intermediate properties after refactoring, assuming nested traversal happens without @Valid on the container property.
Related errors
- Error validating imported build spec (import project: %s, im
- Unable to reach the property to validate.
- Invalid property path.
- No value extractor found for type {type}.
- Property path must provide index or map key.
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/0731f98f62765991.
Report an issue: GitHub.