Rubocop fails with undefined StringIO

If your rubocop run fails with a stack like

rubocop-1.61.0/lib/rubocop/server/socket_reader.rb:36:in `ensure in read!': undefined method `string' for nil:NilClass (NoMethodError)
        Cache.stderr_path.write(stderr.string)
                                      ^^^^^^^
...
rubocop-1.61.0/lib/rubocop/server/socket_reader.rb:27:in `read!': uninitialized constant RuboCop::Server::SocketReader::StringIO (NameError)

        stderr = StringIO.new
                 ^^^^^^^^

this card might help you.

In old versions of rubocop stringio was used but not required. This was fixed in v1.68.0 Show archive.org snapshot .

Upgrading makandra-rubocop to v15.0.0 will lift rubocop from 1.61 to 1.70.

Warning

after an upgrade, make sure to terminate all running rubocop server processes (ps aux | grep rubocop, then kill the pid)

Daniel Straßner