theonedev/onedev · error · IllegalArgumentException
Invalid property path.
Error message
Invalid property path.
What it means
Before validating a property, ValidatorImpl.sanityCheckPropertyPath rejects a null or empty property name, since Bean Validation requires a concrete property path. Passing null or "" to validateProperty/validateValue throws "Invalid property path." (IllegalArgumentException).
Source
Thrown at server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java:367
@Override
public ExecutableValidator forExecutables() {
return this;
}
private ValidationContextBuilder getValidationContextBuilder() {
return new ValidationContextBuilder(
constraintValidatorManager,
constraintValidatorFactory,
validatorScopedContext,
TraversableResolvers.wrapWithCachingForSingleValidation( traversableResolver, validatorScopedContext.isTraversableResolverResultCacheEnabled() ),
constraintValidatorInitializationContext
);
}
private void sanityCheckPropertyPath(String propertyName) {
if ( propertyName == null || propertyName.length() == 0 ) {
throw LOG.getInvalidPropertyPathException();
}
}
private void sanityCheckGroups(Class<?>[] groups) {
Contracts.assertNotNull( groups, MESSAGES.groupMustNotBeNull() );
for ( Class<?> clazz : groups ) {
if ( clazz == null ) {
throw new IllegalArgumentException( MESSAGES.groupMustNotBeNull() );
}
}
}
private ValidationOrder determineGroupValidationOrder(Class<?>[] groups) {
Collection<Class<?>> resultGroups;
// if no groups is specified use the default
if ( groups.length == 0 ) {
resultGroups = DEFAULT_GROUPS;
}View on GitHub (pinned to d44925c47c)
Solutions
- Ensure the property name is non-null and non-empty before calling validateProperty/validateValue
- Trim and check dynamic property strings at the source
- If the intent was to validate everything, use validate(bean) instead of a property path
Example fix
// before
validator.validateProperty(user, cfg.getPropertyName());
// after
String prop = cfg.getPropertyName();
if (prop != null && !prop.trim().isEmpty()) {
validator.validateProperty(user, prop.trim());
} Defensive patterns
Strategy: validation
Validate before calling
if (propertyName == null || propertyName.isEmpty()) throw new IllegalArgumentException("propertyName required"); Type guard
boolean isValidPropertyPath(String p) { return p != null && !p.trim().isEmpty(); } Try / catch
try { validator.validateProperty(bean, prop); } catch (IllegalArgumentException e) { throw new BadRequestException("Invalid property path: " + prop, e); } Prevention
- Validate dynamic property names at the source (config/annotations)
- Default to whole-bean validation when no specific property is given
When it happens
Trigger: Calling validateProperty(bean, null) or validateValue(cls, "", value); commonly when the property name is derived dynamically from a variable that is unset or blank.
Common situations: Reflection-based frameworks building validation calls from metadata where the field name is missing; user-supplied property names that were never validated; empty config keys.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Unable to reach the property to validate.
- The group must not be null.
- Type not supported for unwrapping: {type}
- Invalid property path: {path}.
- Error validating imported build spec (import project: %s, im
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/dc9c620fca2bfc32.
Report an issue: GitHub.