quarkusio/quarkus · info · IllegalArgumentException
Currently only 'fruitsFindBy?type=name' is supported
Error message
Currently only 'fruitsFindBy?type=name' is supported
What it means
Same guard as the datasource variant: findBy() in the discriminator test FruitResource only supports type=name and throws IllegalArgumentException for any other filter type. The named query 'Fruits.findByName' is the only implemented search, by design of this multitenancy test fixture.
Source
Thrown at integration-tests/hibernate-orm-tenancy/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java:166
entityManager.remove(fruit);
return Response.status(204).build();
}
@GET
@Path("fruitsFindBy")
public Response findByDefault(@NotNull @QueryParam("type") String type, @NotNull @QueryParam("value") String value) {
return findBy(type, value);
}
@GET
@Path("{tenant}/fruitsFindBy")
public Response findByTenant(@NotNull @QueryParam("type") String type, @NotNull @QueryParam("value") String value) {
return findBy(type, value);
}
private Response findBy(@NotNull String type, @NotNull String value) {
if (!"name".equalsIgnoreCase(type)) {
throw new IllegalArgumentException("Currently only 'fruitsFindBy?type=name' is supported");
}
List<Fruit> list = entityManager.createNamedQuery("Fruits.findByName", Fruit.class).setParameter("name", value)
.getResultList();
if (list.size() == 0) {
return Response.status(404).build();
}
Fruit fruit = list.get(0);
return Response.status(200).entity(fruit).build();
}
@Provider
public static class ErrorMapper implements ExceptionMapper<Exception> {
@Override
public Response toResponse(Exception exception) {
LOG.error("Failed to handle request", exception);
int code = 500;View on GitHub (pinned to e1c734241f)
Solutions
- Call with type=name (e.g. ?type=name&value=Apple).
- Add handling for additional types in findBy() if the test needs them.
- Catch the IllegalArgumentException and return 400 with a clear message.
Example fix
// before
if (!"name".equalsIgnoreCase(type)) {
throw new IllegalArgumentException("Currently only 'fruitsFindBy?type=name' is supported");
}
// after
switch (type.toLowerCase()) {
case "name": /* existing query */ break;
default: return Response.status(400).entity("Unsupported type: " + type).build();
} Defensive patterns
Strategy: validation
Validate before calling
if (!"name".equalsIgnoreCase(type)) {
throw new IllegalArgumentException("Only type=name is supported");
} Try / catch
try {
resource.findByTenant(type, value);
} catch (IllegalArgumentException e) {
// retry with type=name or return 400 to the caller
} Prevention
- Restrict calls to type=name on fruitsFindBy.
- Extend findBy() explicitly for new filter types.
- Add parameterized tests over accepted type values.
When it happens
Trigger: GET fruitsFindBy with type other than "name" (e.g. ?type=id or ?type=color) via findByTenant or findByDefault on integration-tests/hibernate-orm-tenancy/discriminator.
Common situations: Assuming the test endpoint supports generic filtering; typos in the type parameter; tooling that URL-encodes or alters the parameter casing unexpectedly (matching is case-insensitive, so casing itself is safe).
Related errors
- Currently only 'fruitsFindBy?type=name' is supported
- Extra steps left over
- Unknown start character for json value: %s
- Currently only 'fruitsFindBy?type=name' is supported
- Id was invalidly set on request.
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/3fdfe46c688c6ce3.
Report an issue: GitHub.