I had the exact same issue. I updated Ruby version to 3.3.5 and the problem was solved. I hope it's useful for you.