The org.springframework.web.bind.MissingPathVariableException is intended to return a 400 status code in case the value is missing after conversion. This is indicated by the getStatusCode() method:

    @Override
    public HttpStatusCode getStatusCode() {
        return (isMissingAfterConversion() ? HttpStatus.BAD_REQUEST : HttpStatus.INTERNAL_SERVER_ERROR);
    }

However, when used in combination with a ProblemDetail, the status code set in the problem detail will always be 500. This is caused by the fact that the ProblemDetail instance is initialized during construction of ServletRequestBindingException before the missingAfterConversion field is initialized in MissingRequestValueException, resulting in the invocation of getStatusCode() (in ServletRequestBindingException) to always return HttpStatus.INTERNAL_SERVER_ERROR.

The http response code will be 400 as expected.