I had the same problem after updating to Rails 7.2.
I always use the console with pry-rails so I just needed to update the gem to (0.3.11)
pry-rails
(0.3.11)