{"record":{"id":"3fdfe46c688c6ce3","repo":"quarkusio/quarkus","slug":"currently-only-fruitsfindby-type-name-is-support-3fdfe4","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/discriminator/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/discriminator/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java#L148-L184","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"// before\nif (!\"name\".equalsIgnoreCase(type)) {\n    throw new IllegalArgumentException(\"Currently only 'fruitsFindBy?type=name' is supported\");\n}\n// after\nswitch (type.toLowerCase()) {\n    case \"name\": /* existing query */ break;\n    default: return Response.status(400).entity(\"Unsupported type: \" + type).build();\n}","handlingStrategy":"validation","validationCode":"if (!\"name\".equalsIgnoreCase(type)) {\n    throw new IllegalArgumentException(\"Only type=name is supported\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    resource.findByTenant(type, value);\n} catch (IllegalArgumentException e) {\n    // retry with type=name or return 400 to the caller\n}","preventionTips":["Restrict calls to type=name on fruitsFindBy.","Extend findBy() explicitly for new filter types.","Add parameterized tests over accepted type values."],"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"}