{"record":{"id":"488aff3fa3f08987","repo":"quarkusio/quarkus","slug":"fruit-name-was-not-set-on-request-488aff","errorCode":null,"errorMessage":"Fruit Name was not set on request.","messagePattern":"Fruit Name was not set on request\\.","errorType":"http","errorClass":"WebApplicationException","httpStatus":422,"severity":"error","filePath":"integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java","lineNumber":114,"sourceCode":"    }\n\n    @PUT\n    @Path(\"fruits/{id}\")\n    @Transactional\n    public Fruit updateDefault(@PathParam(\"id\") int id, @NotNull Fruit fruit) {\n        return update(id, fruit);\n    }\n\n    @PUT\n    @Path(\"{tenant}/fruits/{id}\")\n    @Transactional\n    public Fruit updateTenant(@PathParam(\"id\") int id, @NotNull Fruit fruit) {\n        return update(id, fruit);\n    }\n\n    private Fruit update(@NotNull @PathParam(\"id\") int id, @NotNull Fruit fruit) {\n        if (fruit.getName() == null) {\n            throw new WebApplicationException(\"Fruit Name was not set on request.\", 422);\n        }\n\n        Fruit entity = entityManager.find(Fruit.class, id);\n        if (entity == null) {\n            throw new WebApplicationException(\"Fruit with id of \" + id + \" does not exist.\", 404);\n        }\n        entity.setName(fruit.getName());\n\n        LOG.debugv(\"Update #{0} {1}\", fruit.getId(), fruit.getName());\n\n        return entity;\n    }\n\n    @DELETE\n    @Path(\"fruits/{id}\")\n    @Transactional\n    public Response deleteDefault(@PathParam(\"id\") int id) {\n        return delete(id);","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java#L96-L132","documentation":"FruitResource.update throws this WebApplicationException (HTTP 422) when the PUT request body omits the fruit name. The update logic only copies the name from the body onto the managed entity, so a null name would wipe it; the endpoint rejects such requests up front.","triggerScenarios":"PUT to /fruits/{id} (or tenant-scoped update) with a Fruit JSON body whose \"name\" field is missing or null.","commonSituations":"Partial-update clients sending only the fields they want to change (PATCH-style usage of a PUT endpoint), or DTOs where name was never populated.","solutions":["Include the name field in the JSON body of the PUT request.","Fetch the entity first and send the complete representation, or switch semantics to a PATCH endpoint that keeps the old name when the field is absent.","On the client, validate the payload has a non-null name before sending."],"exampleFix":"// before\nPUT /fruits/1\n{\"name\": null}\n// after\nPUT /fruits/1\n{\"name\": \"Apple\"}","handlingStrategy":"validation","validationCode":"if (fruit.getName() == null || fruit.getName().isBlank()) {\n    throw new IllegalArgumentException(\"name is required for PUT /fruits/{id}\");\n}","typeGuard":"boolean isUpdatable(io.quarkus.it.hibernate.multitenancy.fruit.Fruit f) {\n    return f != null && f.getName() != null && !f.getName().isBlank();\n}","tryCatchPattern":"try {\n    fruit = target(\"/fruits/\" + id).request().put(Entity.json(body), Fruit.class);\n} catch (WebApplicationException e) {\n    if (e.getResponse().getStatus() == 422) { /* name missing in body */ }\n}","preventionTips":["Send full entity representations on PUT","Validate required fields client-side before send","Keep PATCH semantics in a separate endpoint","Write contract tests asserting required fields"],"tags":["rest","validation","jpa","http-422"],"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"}