quarkusio/quarkus · error · IllegalArgumentException
Currently only 'fruitsFindBy?type=name' is supported
Error message
Currently only 'fruitsFindBy?type=name' is supported
What it means
Identical guard to the schema variant: the findBy helper in the schema-mariadb FruitResource rejects any value of the @QueryParam("type") other than 'name' (case-insensitive) because that is the only search implemented, raising IllegalArgumentException. The named query Fruits.findByName is then used for the actual lookup.
Source
Thrown at integration-tests/hibernate-orm-tenancy/schema-mariadb/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
- Send type=name: GET /fruitsFindBy?type=name&value=<name>
- Add the desired type branch in findBy backed by an additional @NamedQuery
- Add an ExceptionMapper mapping IllegalArgumentException to 400 for a proper client-facing error
Example fix
// before GET /fruitsFindBy?type=colour&value=red // after GET /fruitsFindBy?type=name&value=Pear
Defensive patterns
Strategy: validation
Validate before calling
Map<String,String> q = new HashMap<>();
if (type == null || !type.equalsIgnoreCase("name")) {
throw new IllegalArgumentException("fruitsFindBy only supports type=name");
}
q.put("type", "name"); q.put("value", value); Try / catch
try {
given().queryParams("type", type, "value", value).get("/fruitsFindBy");
} catch (IllegalArgumentException e) {
// retry with type=name
} Prevention
- Hard-code type=name for this endpoint unless extended
- Document supported query types in the API contract/test base
- Validate query parameters before requests in shared test helpers
- Add an ExceptionMapper for a 400 instead of a 500 on bad types
When it happens
Trigger: GET /fruitsFindBy?type=<not-name>&value=... on the schema-mariadb app via findByDefault or findByTenant, e.g. type=colour, type=ID, empty type.
Common situations: Assuming the demo endpoint supports arbitrary fields; copy-paste of query strings from other APIs; programmatic test parametrization generating unsupported type values.
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
- Currently only 'fruitsFindBy?type=name' is supported
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/43f4df4ac9b4beeb.
Report an issue: GitHub.