quarkusio/quarkus · warning · WebApplicationException
Fruit Name was not set on request.
Error message
Fruit Name was not set on request.
What it means
Thrown by the update helper of the schema-mariadb FruitResource when the PUT request body has a null name. An update without a name is considered an invalid representation, so the resource responds with HTTP 422 (Unprocessable Entity) before touching the database, and the surrounding @Transactional work aborts.
Source
Thrown at integration-tests/hibernate-orm-tenancy/schema-mariadb/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 PUT request body
- Client-side validate that name is non-null/non-blank before sending
- For partial updates, implement PATCH semantics or fetch-modify-PUT the full entity
- Return a clearer message via bean validation (@NotBlank on the entity) if desired
Example fix
// before
given().body("{}").put("/fruits/1"); // 422 name missing
// after
given().contentType(ContentType.JSON).body(new Fruit("Apple")).put("/fruits/1"); // name present Defensive patterns
Strategy: validation
Validate before calling
Objects.requireNonNull(fruit.getName(), "name is required for PUT /fruits/{id}"); Type guard
static boolean isUpdatable(Fruit f) {
return f != null && f.getName() != null && !f.getName().isBlank();
} Try / catch
try {
given().body(fruit).put("/fruits/" + id);
} catch (WebApplicationException e) {
if (e.getResponse().getStatus() == 422) { /* supply a name and retry */ }
else throw e;
} Prevention
- Validate required fields (name) before sending PUT
- Remember PUT requires full representation; use fetch-modify-PUT for partial changes
- Make UI forms require the name field before submit
- In tests, always construct Fruit with a non-null name
When it happens
Trigger: PUT /fruits/{id} with a JSON body missing the name field ("{}" or {"id":1}), or a Fruit deserialized where name was never set.
Common situations: Client sends a partial update payload assuming PATCH semantics on a PUT endpoint; serialization drops the name due to a DTO mapping bug; frontend form allows empty submit.
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.
- Extra steps left over
- Unknown start character for json value: %s
- Id was invalidly set on request.
- Fruit Name was not set on request.
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/5afbdafcdb2f6fba.
Report an issue: GitHub.