Capistrano breaks while applying newly released rails patch

Aug 12, 2016 - Prakash Murthy

A new version of rails 4 - version - was announced yesterday. Given this release includes important security fixes, it is highly recommended that the rails app be upgraded when possible.


The upgrade process to apply this security patch on a client application went smoothly except for a minor issue with Capistrano. Running cap deploy command gave the following error message:

Googling the error message led to the following 2 pages:

  1. Stackoverflow: Capistrano error: undefined method 'already_invoked'
  2. Github Issues: Capistrano 3.6.0 breaks when used with Rake < 11.0.0

So turns out the new version of Capistrano - 3.6.0 - has a bug that makes it incompatible with versions of rake gem < 11.0.0. The solution is to upgrade the rake version to 11.0.0 or higher. If that is not an option, then downgrade Capistrano version to 3.5.0 temporarily till a new version of Capistrano is released with the fix.

In this case, the rake gem was locked at 10.4.2 in the Gemfile. After reviewing the code history, it was clear that there was no need to lock the rake gem at a specific version. So removed the line gem 'rake', '10.4.2' from the Gemfile to fix the problem with Capistrano.

Happy Upgrading!

Back to Blog