Closed
Description
Observed Behavior
Fetching the profile for an unknown repository called foo
:
GET http://localhost:8080/profile/foo
yields a 500 Internal Server Error
with following response:
{
"cause": null,
"message": "Could not resolve repository metadata for foo."
}
The culprit seems to
be org.springframework.data.rest.webmvc.config.ResourceMetadataHandlerMethodArgumentResolver
throwing an IllegalArgumentException
when it is not able to resolve the repository.
Expected Behavior
A 404 Not Found
is returned like
{
"timestamp": "2025-05-14T19:51:01.935+00:00",
"status": 404,
"error": "Not Found",
"path": "/profile/foo"
}
Steps To Reproduce
I created a small reproducer with can be checked out in this repository, the readme there also contains a similar description as this issue.
- Start application
- Fetch profile for unknown repository
curl -X GET --location "http://localhost:8080/profile/foo" -H "Accept: application/json"
- Retrieve
500 Internal Server Error
Spring Initializr Setup
- Project: Gradle - Kotlin
- Language: Java
- Spring Boot: 3.4.5
- Packaging: Jar
- Java: 21
- Dependencies
- Spring Data JPA
- Rest Repositories
- H2 Database
Similar/Related issues
Some issue I already found that sounds similar is #2014, but that conversation came to an halt.