quarkusio/quarkus · error · IllegalArgumentException
Method ${method} of Repository ${repository}has invalid para
Error message
Method ${method} of Repository ${repository}has invalid parameters - only a single parameter of type Pageable can be specified What it means
Derived (method-name based) repository methods accept at most one paging parameter. A method signature that declares two or more parameters of type Pageable (or PageRequest) is rejected at build time by DerivedMethodsAdder.add because the generated code cannot decide which Pageable to apply.
Source
Thrown at extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/DerivedMethodsAdder.java:115
continue;
}
Type returnType = method.returnType();
List<Type> parameters = method.parameterTypes();
String[] parameterTypesStr = new String[parameters.size()];
List<Integer> queryParameterIndexes = new ArrayList<>(parameters.size());
Integer pageableParameterIndex = null;
Integer sortParameterIndex = null;
Integer dynamicProjectionParameterIndex = null;
for (int i = 0; i < parameters.size(); i++) {
Type paramType = parameters.get(i);
DotName parameterType = paramType.name();
parameterTypesStr[i] = parameterType.toString();
if (DotNames.SPRING_DATA_PAGEABLE.equals(parameterType)
|| DotNames.SPRING_DATA_PAGE_REQUEST.equals(parameterType)) {
if (pageableParameterIndex != null) {
throw new IllegalArgumentException("Method " + method.name() + " of Repository " + repositoryClassInfo
+ "has invalid parameters - only a single parameter of type" + DotNames.SPRING_DATA_PAGEABLE
+ " can be specified");
}
pageableParameterIndex = i;
} else if (DotNames.SPRING_DATA_SORT.equals(parameterType)) {
if (sortParameterIndex != null) {
throw new IllegalArgumentException("Method " + method.name() + " of Repository " + repositoryClassInfo
+ "has invalid parameters - only a single parameter of type" + DotNames.SPRING_DATA_SORT
+ " can be specified");
}
sortParameterIndex = i;
} else if (isDynamicProjectionParameter(paramType, method)) {
if (dynamicProjectionParameterIndex != null) {
throw new IllegalArgumentException("Method " + method.name() + " of Repository " + repositoryClassInfo
+ "has invalid parameters - only a single dynamic projection parameter of type "
+ DotNames.CLASS + " can be specified");
}
dynamicProjectionParameterIndex = i;View on GitHub (pinned to e1c734241f)
Solutions
- Remove the duplicate Pageable/PageRequest parameter, keeping only one
- If extra paging-like data is needed, fold it into a single Pageable via PageRequest.of(page, size, sort)
- Move the second paging parameter out of the repository method signature
- If the method is not derived, give it an explicit @Query and handle parameters manually
Example fix
// before List<User> findByName(String name, Pageable p1, Pageable p2); // after List<User> findByName(String name, Pageable p);
Defensive patterns
Strategy: validation
Validate before calling
long pageableCount = Arrays.stream(m.getParameterTypes())
.filter(t -> Pageable.class.isAssignableFrom(t) || PageRequest.class.isAssignableFrom(t)).count(); Prevention
- At most one Pageable per repository method
- Carry sorting inside Pageable instead of extra parameters
- Review derived method signatures for duplicate paging params
When it happens
Trigger: Declaring a derived query method like List<User> findByName(String n, Pageable p1, Pageable p2); the second Pageable/PageRequest parameter triggers the throw.
Common situations: Copy-paste signature errors; trying to pass page info plus a second 'pageable-like' object; refactoring where a Pageable was duplicated.
Related errors
- Method ${method.name()} of Repository ${repositoryClassInfo}
- ${method.name()} of Repository ${repositoryClassInfo} is mea
- Method ${method} of Repository ${repository}has invalid para
- Method ${method} of Repository ${repository}has invalid para
- Method ${repositoryMethodDescription} cannot be parsed. Did
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/57acf702d15ad910.
Report an issue: GitHub.