quarkusio/quarkus · warning · IllegalArgumentException

Currently only 'fruitsFindBy?type=name' is supported

Error message

Currently only 'fruitsFindBy?type=name' is supported

What it means

The findBy endpoint only supports filtering by name; any other 'type' query parameter value is rejected with an IllegalArgumentException (resulting in a 500 unless mapped), explicitly stating the only supported form is fruitsFindBy?type=name.

Source

Thrown at integration-tests/hibernate-orm-tenancy/connection-resolver/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. Use type=name with the entity name as value
  2. If another filter type is needed, extend the resource with a named query for it
  3. Fix the client constant/enum producing the type value

Example fix

// before
GET /fruits/findBy?type=color&value=red
// after
GET /fruits/findBy?type=name&value=Apple
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try { findBy(type, value); } catch (IllegalArgumentException e) { /* fall back to type=name or surface a 400 */ }

Prevention

When it happens

Trigger: Calling fruitsFindByDefault/fruitsFindByTenant with ?type=something-else&value=x, or omitting/mistyping the type parameter.

Common situations: Clients guessing at supported filter types (e.g. 'color', 'id'), case assumptions (although equalsIgnoreCase is used, so case is fine), or API drift between client and resource.

Related errors


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