quarkusio/quarkus · error · UnableToParseMethodException
fieldNotResolvableMessage + offendingMethodMessage
Error message
fieldNotResolvableMessage + offendingMethodMessage
What it means
While resolving a possibly underscore-separated (nested) field path in a derived query method, the parser consumed a segment but ran off the end of the expression without finding a next segment, meaning the path was truncated. It throws UnableToParseMethodException with the 'Entity ... does not contain a field named: ...' prefix.
Source
Thrown at extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/MethodNameParser.java:517
FieldInfo fieldInfo = null;
MutableReference<List<ClassInfo>> parentSuperClassInfos = new MutableReference<>();
int fieldStartIndex = 0;
ClassInfo parentFieldInfo = null;
while (fieldStartIndex < fieldPathExpression.length()) {
// The underscore character is treated as reserved character to manually define traversal points.
// This means that path expression may have multiple levels separated by the '_' character. For example: person_address_city.
if (fieldPathExpression.charAt(fieldStartIndex) == '_') {
// See issue #34395
// For resolving correctly nested fields added using '_' we need to get the previous fieldInfo which will be the class containing the field starting by '_' in this loop.
DotName parentFieldInfoName;
if (fieldInfo != null && fieldInfo.type().kind() == Type.Kind.PARAMETERIZED_TYPE) {
parentFieldInfoName = fieldInfo.type().asParameterizedType().arguments().stream().findFirst().get().name();
parentFieldInfo = indexView.getClassByName(parentFieldInfoName);
}
fieldStartIndex++;
if (fieldStartIndex >= fieldPathExpression.length()) {
throw new UnableToParseMethodException(fieldNotResolvableMessage + offendingMethodMessage);
}
}
int firstSeparator = fieldPathExpression.indexOf('_', fieldStartIndex);
int fieldEndIndex = firstSeparator == -1 ? fieldPathExpression.length() : firstSeparator;
while (fieldEndIndex >= fieldStartIndex) {
String fieldName = fieldPathExpression.substring(fieldStartIndex, fieldEndIndex);
String simpleFieldName = lowerFirstLetter(fieldName);
fieldInfo = getFieldInfo(simpleFieldName, parentFieldInfo == null ? parentClassInfo : parentFieldInfo,
parentSuperClassInfos);
if (fieldInfo != null) {
break;
}
fieldEndIndex = previousPotentialFieldEnd(fieldPathExpression, fieldStartIndex, fieldEndIndex);
}
if (fieldInfo == null) {
String detail = "";
if (fieldStartIndex > 0) {
String notMatched = lowerFirstLetter(fieldPathExpression.substring(fieldStartIndex));View on GitHub (pinned to e1c734241f)
Solutions
- Complete the field path after the underscore: findByAddress_City(...)
- Remove the trailing underscore if the field is not nested: findByAddress(...)
- Use @Query with explicit JPQL for complex nested paths
Example fix
// before List<User> findByAddress_(); // after List<User> findByAddress_City(String city);
Defensive patterns
Strategy: validation
Validate before calling
// Check for dangling separators in method names:
// assertFalse(methodName.contains("__") || methodName.endsWith("_"), methodName); Try / catch
try {
parser.parse(methodName);
} catch (UnableToParseMethodException e) {
// complete or remove the trailing underscore path
throw new IllegalStateException("Truncated nested path: " + e.getMessage());
} Prevention
- Never end a field path with an underscore
- Use underscore-separated full paths: findByAddress_City(...)
- Review auto-generated or scripted repository method names for truncated paths
When it happens
Trigger: A method name field path ends with an underscore or trailing separator, e.g. findByAddress_ (nothing after '_'), or the path after the last '_' is empty — fieldStartIndex reaches fieldPathExpression.length().
Common situations: Half-deleted nested path during refactoring; auto-generated method names with dangling separators; typos where the final segment was omitted.
Related errors
- Field ${orderField} which was configured as the order field
- fieldNotResolvableMessage + detail + offendingMethodMessage
- Distinct is not yet supported. Offending method is ${reposit
- A field must by supplied after 'OrderBy' . Offending method
- IgnoreCase cannot be specified for field${fieldInfo.name()}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/92546b5189cc6508.
Report an issue: GitHub.