TypeError: wrong argument type OpenSSL/SSL/CTX (expected (null)) when running gem


My mastodon instance: https://social.slat.org/ version 3.0.1.

I found that when I run commands like gem update I got error:

$ gem update --system
ERROR: While executing gem … (TypeError)
wrong argument type OpenSSL/SSL/CTX (expected (null))

I couldn’t find any resources discussing about this. Could anyone please give me a hint? Thanks.

which version of #openssl and the ruby gem are there?

System (Debian Buster) openssl v 1.1.1d

Ruby version 2.6.5
gem version 3.0.3
rubygem openssl 2.1.2

It was so strange that when I ran any gem command it threw such error. So I removed and reinstalled Ruby 2.6.5, then the error was gone. Instead, it became a lot “No such file or directory” (ENOENT). I’ll describe it in another thread.


Did you reinstall all the ruby “gems” afterwards? I am afraid it was not a fix, it just made a problem worse.

No. I didn’t.

But when I upgraded to v3.0.1 the first time, I got a lot problems installing Ruby gems the version mentioned in Gemfile.lock. I had to install the whole gem rubys in another folder and copied the cache gem files and Gemfile.lock to make it work. So the versions of my gems are somewhat different then the one in tag v3.0.1.