I was setting up a virtual server that’s using resque to perform background jobs and when I ran into the following error:

$ resque-web
/var/lib/gems/1.8/gems/rack-1.6.4/lib/rack/handler.rb:22:in `const_get': wrong number of arguments (2 for 1) (ArgumentError)
        from /var/lib/gems/1.8/gems/rack-1.6.4/lib/rack/handler.rb:22:in `get'
        from /var/lib/gems/1.8/gems/vegas-0.1.11/lib/vegas/runner.rb:280:in `setup_rack_handler'
        from /var/lib/gems/1.8/gems/vegas-0.1.11/lib/vegas/runner.rb:278:in `each'
        from /var/lib/gems/1.8/gems/vegas-0.1.11/lib/vegas/runner.rb:278:in `setup_rack_handler'
        from /var/lib/gems/1.8/gems/vegas-0.1.11/lib/vegas/runner.rb:36:in `initialize'
        from /var/lib/gems/1.8/gems/resque-1.26.0/bin/resque-web:13:in `new'
        from /var/lib/gems/1.8/gems/resque-1.26.0/bin/resque-web:13
        from /usr/local/bin/resque-web:19:in `load'
        from /usr/local/bin/resque-web:19

After a lot of fighting I learned that Sinatra wasn’t compatible with rack 1.6.x so the only way to fix the problem was to downgrade to a version that worked. After much testing it appears that 1.5.5 was the last version that worked.

First we need to uninstall rack which also removed sinatra and vegas.

$ sudo gem uninstall rack

You have requested to uninstall the gem:
        rack-1.6.4
rack-protection-1.5.3 depends on [rack (>= 0)]
sinatra-1.4.7 depends on [rack (~> 1.5)]
vegas-0.1.11 depends on [rack (>= 1.0.0)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Remove executables:
        rackup

in addition to the gem? [Yn]  y
Removing rackup
Successfully uninstalled rack-1.6.4

Then we force the correct version to install:

$ sudo gem install rack --version 1.5.5
Successfully installed rack-1.5.5
1 gem installed
Installing ri documentation for rack-1.5.5...
Installing RDoc documentation for rack-1.5.5...

In our case we had to reinstall resque as well to fix it’s dependences.

$ sudo gem install resque

Successfully installed resque-1.26.0
1 gem installed
Installing ri documentation for resque-1.26.0...
Installing RDoc documentation for resque-1.26.0...
$

Finally we can get it to work.

$ resque-web
[Tue Mar 22 13:08:43 +0000 2016] Starting 'resque-web'...