quarkusio/quarkus · error · WebApplicationException
Fruit Name was not set on request.
Error message
Fruit Name was not set on request.
What it means
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.
Source
Thrown at integration-tests/hibernate-orm-tenancy/connection-resolver-legacy-qualifiers/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
- 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.
Example fix
// before
PUT /fruits/1
{"name": null}
// after
PUT /fruits/1
{"name": "Apple"} Defensive patterns
Strategy: validation
Validate before calling
if (fruit.getName() == null || fruit.getName().isBlank()) {
throw new IllegalArgumentException("name is required for PUT /fruits/{id}");
} Type guard
boolean isUpdatable(io.quarkus.it.hibernate.multitenancy.fruit.Fruit f) {
return f != null && f.getName() != null && !f.getName().isBlank();
} Try / catch
try {
fruit = target("/fruits/" + id).request().put(Entity.json(body), Fruit.class);
} catch (WebApplicationException e) {
if (e.getResponse().getStatus() == 422) { /* name missing in body */ }
} Prevention
- 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
When it happens
Trigger: PUT to /fruits/{id} (or tenant-scoped update) with a Fruit JSON body whose "name" field is missing or null.
Common situations: 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.
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.
- 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.
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/488aff3fa3f08987.
Report an issue: GitHub.