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.

That can definitely lead to problems…

What about this:

can you be more specific about those problems? Maybe we should solve them in the first place…

For this TypeError problem, I then solved it by uninstalling ruby 2.6.5 and re-installing it.

Then for the dependencies issues, in github issue 12432 I solved it by reverting everything back and re-install Mastodon v3.0.1 again.

Still have no idea why I failed the dependencies when upgrading to v3.0.1 the first time. Maybe the yarn and gem repositories got some problems at that time and led my instances to a lot of troubles… Anyway starting over everything solved my problems.