{"record":{"id":"51f3e2a6e2e5ec73","repo":"quarkusio/quarkus","slug":"currently-only-fruitsfindby-type-name-is-support-51f3e2","errorCode":null,"errorMessage":"Currently only 'fruitsFindBy?type=name' is supported","messagePattern":"Currently only 'fruitsFindBy\\?type=name' is supported","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"info","filePath":"integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java","lineNumber":166,"sourceCode":"        entityManager.remove(fruit);\n        return Response.status(204).build();\n    }\n\n    @GET\n    @Path(\"fruitsFindBy\")\n    public Response findByDefault(@NotNull @QueryParam(\"type\") String type, @NotNull @QueryParam(\"value\") String value) {\n        return findBy(type, value);\n    }\n\n    @GET\n    @Path(\"{tenant}/fruitsFindBy\")\n    public Response findByTenant(@NotNull @QueryParam(\"type\") String type, @NotNull @QueryParam(\"value\") String value) {\n        return findBy(type, value);\n    }\n\n    private Response findBy(@NotNull String type, @NotNull String value) {\n        if (!\"name\".equalsIgnoreCase(type)) {\n            throw new IllegalArgumentException(\"Currently only 'fruitsFindBy?type=name' is supported\");\n        }\n        List<Fruit> list = entityManager.createNamedQuery(\"Fruits.findByName\", Fruit.class).setParameter(\"name\", value)\n                .getResultList();\n        if (list.size() == 0) {\n            return Response.status(404).build();\n        }\n        Fruit fruit = list.get(0);\n        return Response.status(200).entity(fruit).build();\n    }\n\n    @Provider\n    public static class ErrorMapper implements ExceptionMapper<Exception> {\n\n        @Override\n        public Response toResponse(Exception exception) {\n            LOG.error(\"Failed to handle request\", exception);\n\n            int code = 500;","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java#L148-L184","documentation":"The private findBy() helper in this test FruitResource only supports lookup by fruit name via the named query 'Fruits.findByName'. Any other 'type' query parameter is rejected with an IllegalArgumentException, which JAX-RS maps to a 500 response unless handled. It is an intentional guard in a multitenancy integration test resource, not a framework error.","triggerScenarios":"Calling GET fruitsFindBy with type != \"name\" (e.g. ?type=color&value=red) on either the default-tenant or tenant-scoped endpoint of integration-tests/hibernate-orm-tenancy/datasource.","commonSituations":"Extending the test endpoint with new filter types and forgetting to update this if-check; calling the endpoint with a misspelled or uppercase-sensitive assumption about the type param; curl/REST-client tests passing an unsupported filter.","solutions":["Use type=name in the query string (e.g. ?type=name&value=Apple).","If you need another filter type, add a branch in findBy() for it with a corresponding named query.","Wrap the call and map IllegalArgumentException to a 400 response via an ExceptionMapper."],"exampleFix":"// before\nif (!\"name\".equalsIgnoreCase(type)) {\n    throw new IllegalArgumentException(\"Currently only 'fruitsFindBy?type=name' is supported\");\n}\n// after\nif (\"color\".equalsIgnoreCase(type)) {\n    list = entityManager.createNamedQuery(\"Fruits.findByColor\", Fruit.class).setParameter(\"color\", value).getResultList();\n} else if (!\"name\".equalsIgnoreCase(type)) {\n    return Response.status(400).entity(\"Unsupported type\").build();\n}","handlingStrategy":"validation","validationCode":"if (!\"name\".equalsIgnoreCase(type)) {\n    throw new IllegalArgumentException(\"Only type=name is supported; got: \" + type);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Response r = resource.findByTenant(type, value);\n} catch (IllegalArgumentException e) {\n    // fall back to type=name or surface a 400 to the caller\n}","preventionTips":["Always pass type=name to the fruitsFindBy endpoint in these test resources.","When adding filter types, extend findBy() and its named queries together.","Write tests covering each supported type value."],"tags":["rest","jaxrs","validation","integration-test"],"backgroundTag":"unsupported-query-parameter","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}