{"record":{"id":"600991b41fa90812","repo":"quarkusio/quarkus","slug":"should-provide-name-or-color-query-parameter-600991","errorCode":null,"errorMessage":"Should provide name or color query parameter","messagePattern":"Should provide name or color query parameter","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"integration-tests/elasticsearch-rest-client/src/main/java/io/quarkus/it/elasticsearch/FruitResource.java","lineNumber":54,"sourceCode":"        return Response.created(URI.create(\"/fruits/\" + fruit.id)).build();\n    }\n\n    @GET\n    @Path(\"/{id}\")\n    public Fruit get(@PathParam(\"id\") String id) throws IOException, ParseException {\n        return fruitService.get(id);\n    }\n\n    @GET\n    @Path(\"/search\")\n    public List<Fruit> search(@QueryParam(\"name\") String name, @QueryParam(\"color\") String color)\n            throws IOException, ParseException {\n        if (name != null) {\n            return fruitService.searchByName(name);\n        } else if (color != null) {\n            return fruitService.searchByColor(color);\n        } else {\n            throw new BadRequestException(\"Should provide name or color query parameter\");\n        }\n    }\n\n    @Path(\"bulk\")\n    @DELETE\n    public Response delete(List<String> identityList) throws IOException {\n        fruitService.delete(identityList);\n        return Response.ok().build();\n    }\n\n    @Path(\"bulk\")\n    @POST\n    public Response index(List<Fruit> list) throws IOException {\n        fruitService.index(list);\n        return Response.ok().build();\n    }\n\n}","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/elasticsearch-rest-client/src/main/java/io/quarkus/it/elasticsearch/FruitResource.java#L36-L72","documentation":"Same BadRequestException as the java-client variant, thrown by the search endpoint of the elasticsearch-rest-client test resource when neither 'name' nor 'color' query parameters are provided. It is a deliberate client-error guard, not an Elasticsearch failure.","triggerScenarios":"GET to the search endpoint with no query parameters or incorrectly named ones (e.g. 'colour', 'fruitName').","commonSituations":"Manual curl/browser tests without ?name= or ?color=; automated clients with wrong parameter names after an API rename.","solutions":["Supply ?name=<value> or ?color=<value> on the request.","Correct the client-side parameter names to match the resource signature.","In tests, assert the 400 status when omitting both parameters."],"exampleFix":"// before\nGET /fruits/search\n// after\nGET /fruits/search?color=red","handlingStrategy":"validation","validationCode":"if (name == null && color == null) {\n    throw new IllegalArgumentException(\"Provide name or color query parameter\");\n}","typeGuard":"null","tryCatchPattern":"try {\n    Response r = target(\"/fruits/search\").queryParam(\"color\", color).request().get();\n} catch (jakarta.ws.rs.BadRequestException e) {\n    log.error(\"Search requires ?name or ?color\");\n}","preventionTips":["Always include ?name or ?color in search calls.","Use typed client wrappers that enforce at least one parameter.","Assert 400 behavior in contract tests."],"tags":["rest","elasticsearch","bad-request"],"backgroundTag":"missing-required-argument","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}