quarkusio/quarkus · error · WebApplicationException
Fruit with id of {id} does not exist.
Error message
Fruit with id of {id} does not exist. What it means
Thrown by the private findById helper of the schema-mariadb FruitResource when entityManager.find(Fruit.class, id) returns null — no Fruit with the given id exists in the tenant being accessed. The exception is a JAX-RS WebApplicationException carrying HTTP 404, so the client receives Not Found. The @Transactional lookup is aborted and any pending changes roll back.
Source
Thrown at integration-tests/hibernate-orm-tenancy/schema-mariadb/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java:70
.getResultList().toArray(new Fruit[0]);
}
@GET
@Path("fruits/{id}")
public Fruit getSingleDefault(@PathParam("id") int id) {
return findById(id);
}
@GET
@Path("{tenant}/fruits/{id}")
public Fruit getSingleTenant(@PathParam("id") int id) {
return findById(id);
}
private Fruit findById(int id) {
Fruit entity = entityManager.find(Fruit.class, id);
if (entity == null) {
throw new WebApplicationException("Fruit with id of " + id + " does not exist.", 404);
}
return entity;
}
@POST
@Transactional
@Path("fruits")
public Response createDefault(@NotNull Fruit fruit) {
return create(fruit);
}
@POST
@Transactional
@Path("{tenant}/fruits")
public Response createTenant(@NotNull Fruit fruit) {
return create(fruit);
}
View on GitHub (pinned to e1c734241f)
Solutions
- Confirm the id exists with a GET against the same tenant before use
- Verify the tenant identifier resolves to the schema containing the data
- Seed the MariaDB schema with the expected Fruit rows before the test/requests
- Create the fruit via POST and use the returned entity id
Example fix
// before
Fruit f = given().header("tenantId", "tenant-fruit").get("/fruits/7").as(Fruit.class); // 404 if 7 absent
// after
Response r = given().header("tenantId", "tenant-fruit").get("/fruits/7");
if (r.getStatusCode() == 404) { /* create or pick a valid id */ } Defensive patterns
Strategy: try-catch
Validate before calling
Response check = given().header("tenantId", tenant).get("/fruits/" + id);
Assume.assumeFalse(check.getStatusCode() == 404); Try / catch
Response r = given().header("tenantId", tenant).get("/fruits/" + id);
if (r.getStatusCode() == 404) {
// handle not-found: seed data or pick a valid id
} else {
Fruit fruit = r.as(Fruit.class);
} Prevention
- Seed MariaDB test data per tenant before assertions
- Never reuse ids across environments or tenants
- Assert status code before deserializing the body
- Send the tenant header consistently (RestAssured filter helps)
When it happens
Trigger: Calling GET /fruits/{id} (default or tenant variant) in the schema-mariadb application with an id that has no row in the active tenant schema.
Common situations: Hard-coded ids from another environment/database; request routed to the wrong tenant schema via tenant header; fruit deleted earlier in the test lifecycle; MariaDB container not seeded with expected test data.
Related errors
- Fruit with id of ${id} does not exist.
- Fruit with id of " + id + " does not exist.
- Currently only 'fruitsFindBy?type=name' is supported
- Extra steps left over
- Unsupported value type: %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/e91b2e464b8234a5.
Report an issue: GitHub.