{"record":{"id":"fd025c30e101776f","repo":"quarkusio/quarkus","slug":"no-person-found-with-name","errorCode":null,"errorMessage":"no Person found with name = ","messagePattern":"no Person found with name = ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonResource.java","lineNumber":104,"sourceCode":"    @Path(\"/count\")\n    @GET\n    public long count() {\n        return personRepository.count();\n    }\n\n    @Path(\"/delete/{id}\")\n    @GET\n    public void delete(@PathParam(\"id\") Long id) {\n        personRepository.deleteById(id);\n    }\n\n    @Transactional\n    @Path(\"/delete/name/first/{name}\")\n    @GET\n    public void deleteFirstByName(@PathParam(\"name\") String name) {\n        List<Person> byName = personRepository.findByName(name);\n        if (byName.isEmpty()) {\n            throw new IllegalArgumentException(\"no Person found with name = \" + name);\n        }\n        personRepository.delete(byName.get(0));\n    }\n\n    @Transactional\n    @Path(\"/delete/name/all/{name}\")\n    @GET\n    public void deleteAllByName(@PathParam(\"name\") String name) {\n        personRepository.deleteAll(personRepository.findByName(name));\n    }\n\n    @Transactional\n    @Path(\"/delete/age/{age}\")\n    @GET\n    public void deleteByAge(@PathParam(\"age\") Integer age) {\n        personRepository.deleteByAge(age);\n    }\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonResource.java#L86-L122","documentation":"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.","triggerScenarios":"GET /delete/name/first/{name} with a name that matches no Person rows in the database.","commonSituations":"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.","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"],"exampleFix":"// before\nif (byName.isEmpty()) {\n    throw new IllegalArgumentException(\"no Person found with name = \" + name);\n}\n// after\nif (byName.isEmpty()) {\n    throw new NotFoundException(\"no Person found with name = \" + name);\n}","handlingStrategy":"validation","validationCode":"List<Person> byName = personRepository.findByName(name);\nif (byName.isEmpty()) {\n    // skip delete / return 404\n}\n","typeGuard":null,"tryCatchPattern":"try {\n    personResource.deleteFirstByName(name);\n} catch (IllegalArgumentException e) {\n    // no Person with that name; treat as 404\n}","preventionTips":["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"],"tags":["jpa","spring-data","rest","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}