quarkusio/quarkus · warning · IllegalArgumentException

Currently only 'fruitsFindBy?type=name' is supported

Error message

Currently only 'fruitsFindBy?type=name' is supported

What it means

FruitResource.findBy only supports searching by name via the named query Fruits.findByName. Any type query parameter other than 'name' (case-insensitive) is rejected with an IllegalArgumentException, which RESTEasy maps to an HTTP 500 unless an exception mapper handles it.

Source

Thrown at integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/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

  1. Call with type=name: GET /fruitsFindBy?type=name&value=Apple.
  2. Fix client code or docs to use the only supported filter.
  3. If other filters are needed, extend the resource with additional named queries and branches for those types.

Example fix

// before
GET /fruitsFindBy?type=id&value=1
// after
GET /fruitsFindBy?type=name&value=Apple
Defensive patterns

Strategy: validation

Validate before calling

if (!"name".equalsIgnoreCase(type)) {
    throw new IllegalArgumentException("Only type=name is supported on fruitsFindBy");
}

Type guard

boolean isNameSearch(String type) {
    return "name".equalsIgnoreCase(type);
}

Try / catch

try {
    return target("fruitsFindBy").queryParam("type", "name").queryParam("value", value).request().get();
} catch (WebApplicationException e) {
    log.error("Search rejected: " + e.getMessage());
}

Prevention

When it happens

Trigger: GET /fruitsFindBy?type=<anything-but-name>&value=... , including empty, misspelled ("names", "Name " with whitespace), or other field types like id.

Common situations: Client guesses at filter field names, API evolves and older clients use removed query types, or value/type parameters are swapped.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/93144cf062092077. Report an issue: GitHub.