{"record":{"id":"5617936d81ea1bfb","repo":"quarkusio/quarkus","slug":"currently-only-fruitsfindby-type-name-is-support-561793","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/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/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java#L148-L184","documentation":"A plain IllegalArgumentException thrown by the private findBy helper of FruitResource to signal that only the query type 'name' is implemented for the fruitsFindBy endpoint. It is a developer/client contract guard: any @QueryParam(\"type\") other than 'name' (case-insensitive) is rejected. As an uncaught IllegalArgumentException in a JAX-RS resource it typically surfaces as HTTP 500 rather than a clean 400.","triggerScenarios":"Calling GET /fruitsFindBy?type=<anything-but-name>&value=... through either the public findByDefault or findByTenant endpoints, e.g. type=id, type=colour, or a misspelled type value.","commonSituations":"Client assumes richer query support than the test resource implements; API evolution where new type values were expected but never implemented; typo in query parameter value ('Name ' with space passes equalsIgnoreCase? no — trailing space fails).","solutions":["Use type=name in the query string: GET /fruitsFindBy?type=name&value=<fruit name>","If you need another search field, extend findBy with an additional branch (e.g. by id) and map it to an appropriate named query","Map IllegalArgumentException to HTTP 400 with an ExceptionMapper for a cleaner client contract"],"exampleFix":"// before\nif (!\"name\".equalsIgnoreCase(type)) {\n    throw new IllegalArgumentException(\"Currently only 'fruitsFindBy?type=name' is supported\");\n}\n// after\nif (\"id\".equalsIgnoreCase(type)) {\n    list = entityManager.createNamedQuery(\"Fruits.findById\", Fruit.class).setParameter(\"id\", Long.valueOf(value)).getResultList();\n} else if (!\"name\".equalsIgnoreCase(type)) {\n    throw new BadRequestException(\"Currently only 'fruitsFindBy?type=name' is supported\");\n}","handlingStrategy":"validation","validationCode":"if (!\"name\".equalsIgnoreCase(type)) {\n    throw new IllegalArgumentException(\"Only type=name is supported by fruitsFindBy\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    given().get(\"/fruitsFindBy?type=\" + type + \"&value=\" + value);\n} catch (Exception e) {\n    // fall back to type=name or fix the query parameter\n}","preventionTips":["Only pass type=name unless the endpoint has been extended","Read the endpoint signature/docs before invoking fruitsFindBy","Parametrize tests only over supported type values","Client-side whitelist of allowed query types"],"tags":["rest","jaxrs","illegal-argument","query-param","validation"],"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"}