{"record":{"id":"43f4df4ac9b4beeb","repo":"quarkusio/quarkus","slug":"currently-only-fruitsfindby-type-name-is-support-43f4df","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":"error","filePath":"integration-tests/hibernate-orm-tenancy/schema-mariadb/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/schema-mariadb/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java#L148-L184","documentation":"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.","triggerScenarios":"GET /fruitsFindBy?type=<not-name>&value=... on the schema-mariadb app via findByDefault or findByTenant, e.g. type=colour, type=ID, empty type.","commonSituations":"Assuming the demo endpoint supports arbitrary fields; copy-paste of query strings from other APIs; programmatic test parametrization generating unsupported type values.","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"],"exampleFix":"// before\nGET /fruitsFindBy?type=colour&value=red\n// after\nGET /fruitsFindBy?type=name&value=Pear","handlingStrategy":"validation","validationCode":"Map<String,String> q = new HashMap<>();\nif (type == null || !type.equalsIgnoreCase(\"name\")) {\n    throw new IllegalArgumentException(\"fruitsFindBy only supports type=name\");\n}\nq.put(\"type\", \"name\"); q.put(\"value\", value);","typeGuard":null,"tryCatchPattern":"try {\n    given().queryParams(\"type\", type, \"value\", value).get(\"/fruitsFindBy\");\n} catch (IllegalArgumentException e) {\n    // retry with type=name\n}","preventionTips":["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"],"tags":["rest","jaxrs","illegal-argument","query-param","validation","mariadb"],"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"}