I had a similar error while trying a restore in 3.1.0.6.
d/shell
sudo gem install thor
solved the missing thor
dependency for me.
But it was a long way to restore a backup by command line:
Downloading archive to tmp directory...
EXCEPTION: Failed to download archive to tmp directory.
This was due to the last test data beeing configured for s3 backups.
d/rails c
SiteSetting.backuo_location="local"
solved that one.
After moving the backup to public\backup\default
the unzipping went fine, but then I was struggling again with Backup restore failing on clean dev docker env: FATAL: Peer authentication failed for user “postgres” - #6 by thoka