quarkusio/quarkus · error · IllegalArgumentException
no Person found with name =
Error message
no Person found with name =
What it means
deleteFirstByName fetches all Persons matching the given name and deletes the first; when the list is empty it throws IllegalArgumentException('no Person found with name = ' + name). Because the method is @Transactional, the exception marks the transaction rollback-only and Jakarta REST surfaces it as a server error.
Source
Thrown at integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonResource.java:104
@Path("/count")
@GET
public long count() {
return personRepository.count();
}
@Path("/delete/{id}")
@GET
public void delete(@PathParam("id") Long id) {
personRepository.deleteById(id);
}
@Transactional
@Path("/delete/name/first/{name}")
@GET
public void deleteFirstByName(@PathParam("name") String name) {
List<Person> byName = personRepository.findByName(name);
if (byName.isEmpty()) {
throw new IllegalArgumentException("no Person found with name = " + name);
}
personRepository.delete(byName.get(0));
}
@Transactional
@Path("/delete/name/all/{name}")
@GET
public void deleteAllByName(@PathParam("name") String name) {
personRepository.deleteAll(personRepository.findByName(name));
}
@Transactional
@Path("/delete/age/{age}")
@GET
public void deleteByAge(@PathParam("age") Integer age) {
personRepository.deleteByAge(age);
}
View on GitHub (pinned to e1c734241f)
Solutions
- Ensure a Person with the given name exists before calling the endpoint (check name spelling and case)
- Catch IllegalArgumentException and map it to HTTP 404 with a descriptive body
- Use personRepository.deleteByName (derived delete) or an Optional-returning finder to handle absence gracefully
Example fix
// before
if (byName.isEmpty()) {
throw new IllegalArgumentException("no Person found with name = " + name);
}
// after
if (byName.isEmpty()) {
throw new NotFoundException("no Person found with name = " + name);
} Defensive patterns
Strategy: validation
Validate before calling
List<Person> byName = personRepository.findByName(name);
if (byName.isEmpty()) {
// skip delete / return 404
}
Try / catch
try {
personResource.deleteFirstByName(name);
} catch (IllegalArgumentException e) {
// no Person with that name; treat as 404
} Prevention
- URL-encode the name path parameter and match case exactly
- Create seed data before delete endpoints in tests
- Prefer Optional/Optional-returning finders and derived deletes over list-then-delete
When it happens
Trigger: GET /delete/name/first/{name} with a name that matches no Person rows in the database.
Common situations: Typo'd or URL-encoded name in the path; calling delete before seed data is created; case-sensitivity mismatches between the stored name and path parameter.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- There is already an active cart
- No Country found with id =
- Distinct is not yet supported. Offending method is ${reposit
- A field must by supplied after 'OrderBy' . Offending method
- Field ${orderField} which was configured as the order field
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/fd025c30e101776f.
Report an issue: GitHub.