@sdeleuze sorry I was creating the sample project here but actually, the problem was in my query I put a different object to return from the method, this was causing the exception above. I'm going to publish the repository to leave as an example.
https://github.com/tiarebalbi/spring-data-kotlin-nullable-query the nullable query it's working as expected!