quarkusio/quarkus · error · WebApplicationException
Fruit Name was not set on request.
Error message
Fruit Name was not set on request.
What it means
WebApplicationException (422) from FruitResource.update: the PUT request body's Fruit object has a null name, which the endpoint's manual validation rejects. The input at fault is the 'name' field of the deserialized Fruit request body; bean validation on @NotNull Fruit alone did not cover it, so the guard fires.
Source
Thrown at integration-tests/hibernate-orm-tenancy/datasource/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java:114
}
@PUT
@Path("fruits/{id}")
@Transactional
public Fruit updateDefault(@PathParam("id") int id, @NotNull Fruit fruit) {
return update(id, fruit);
}
@PUT
@Path("{tenant}/fruits/{id}")
@Transactional
public Fruit updateTenant(@PathParam("id") int id, @NotNull Fruit fruit) {
return update(id, fruit);
}
private Fruit update(@NotNull @PathParam("id") int id, @NotNull Fruit fruit) {
if (fruit.getName() == null) {
throw new WebApplicationException("Fruit Name was not set on request.", 422);
}
Fruit entity = entityManager.find(Fruit.class, id);
if (entity == null) {
throw new WebApplicationException("Fruit with id of " + id + " does not exist.", 404);
}
entity.setName(fruit.getName());
LOG.debugv("Update #{0} {1}", fruit.getId(), fruit.getName());
return entity;
}
@DELETE
@Path("fruits/{id}")
@Transactional
public Response deleteDefault(@PathParam("id") int id) {
return delete(id);View on GitHub (pinned to e1c734241f)
Solutions
- Send the complete entity including name in the PUT body.
- Validate on the client that name is non-null before the request.
- Change the endpoint to PATCH semantics if partial updates are intended.
Example fix
// before
{"id": 1}
// after
{"id": 1, "name": "Banana"} Defensive patterns
Strategy: validation
Validate before calling
if (fruit == null || fruit.getName() == null || fruit.getName().isBlank()) {
throw new IllegalArgumentException("PUT body must include a non-blank name");
} Type guard
boolean hasName(io.quarkus.it.hibernate.multitenancy.fruit.Fruit f) {
return f != null && f.getName() != null && !f.getName().isBlank();
} Try / catch
try {
return target("/fruits/" + id).request().put(Entity.json(fruit), Fruit.class);
} catch (WebApplicationException e) {
if (e.getResponse().getStatus() == 422) { /* fill name and retry once */ }
throw e;
} Prevention
- Always send full representations on PUT
- Client-side required-field validation
- Distinguish PUT (full) from PATCH (partial)
- Assert payloads in integration tests
When it happens
Trigger: PUT /fruits/{id} with JSON body missing "name" or with "name": null.
Common situations: Partial updates sent to a full-replace PUT endpoint, unpopulated client DTO, or serialization dropping null/blank fields.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Id was invalidly set on request.
- Fruit Name was not set on request.
- Id was invalidly set on request.
- Id was invalidly set on request.
- Id was invalidly set on request.
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/66eb9e575b4db73a.
Report an issue: GitHub.