Cloudability logo
Registration is Now Open for CloudyCon 2019
Company News

Nasty Little Rails Bug

By Mat Ellis on June 14, 2011

This week I decided to complete our migration from Chef/Rails 2.3.x/Ruby 1.8.7 to Puppet/Rails 3/Ruby 1.9.2 if only to get us all on one infrastructure. This involved finishing the long put off migration from Rails 2 to 3 for a few old apps— and that’s when our trouble began.

Our app wouldn’t start with a very obscure error:

Digging around the web, folks variously blamed their database.yml file or Psych. One solution even went so far as to force Rails to use what I think is the old YAML parser Syck by putting this at the top of your config/boot.rb file: 

This got 25 upvotes so it’s clearly a big issue. But this had a bad smell so we digged deeper. The answer surprised us: it was in our settings.yml file (it could have been in any yml file to be honest) and was a blank line with unnecessary white space. This white space has been in our codebase for almost 3 years without any issues— it’s only some combination of Psych + RVM + Rails 3.0.7 + Passenger that caused it to complain. Once we removed the unnecessary spaces & tabs everything booted just fine.

The moral of this story: make sure you keep your white space indicator turned on in Textmate and remove it whenever you can.

Being in the know feels great