We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetching the profile for an unknown repository called foo:
foo
GET http://localhost:8080/profile/foo
yields a 500 Internal Server Error with following response:
500 Internal Server Error
{ "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.
IllegalArgumentException
A 404 Not Found is returned like
404 Not Found
{ "timestamp": "2025-05-14T19:51:01.935+00:00", "status": 404, "error": "Not Found", "path": "/profile/foo" }
I created a small reproducer with can be checked out in this repository, the readme there also contains a similar description as this issue.
curl -X GET --location "http://localhost:8080/profile/foo" -H "Accept: application/json"
Some issue I already found that sounds similar is #2014, but that conversation came to an halt.
The text was updated successfully, but these errors were encountered:
For anyone wondering how I workaround in the meantime:
@ControllerAdvice public class PersistenceControllerAdvice { @ExceptionHandler(IllegalArgumentException.class) public ProblemDetail handleIllegalArgumentException(HttpServletRequest request, IllegalArgumentException ex) { if (ex.getMessage() != null && ex.getMessage().contains("Could not resolve repository metadata for")) { String uri = stripLeadingSlash(request.getRequestURI()); return ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, "No static resource " + uri + "."); } else { throw ex; } } private static String stripLeadingSlash(String path) { if (path.startsWith("/")) { return path.substring(1); } else { return path; } } }
Improvements/Suggestions to the workaround appreciated as well :)
Sorry, something went wrong.
No branches or pull requests
Observed Behavior
Fetching the profile for an unknown repository called
foo
:yields a
500 Internal Server Error
with following response: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 likeSteps 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.
curl -X GET --location "http://localhost:8080/profile/foo" -H "Accept: application/json"
500 Internal Server Error
Spring Initializr Setup
Similar/Related issues
Some issue I already found that sounds similar is #2014, but that conversation came to an halt.
The text was updated successfully, but these errors were encountered: