Friday, August 23, 2013

Subtle parse error for database.yml file

Subtle parse error for database.yml file

Recently I was setting up capistrano for a new Rails 3.x application deployment.  In typical fashion I was adjusting the database.yml file for a new environment but subtly introduced and error.  

The specific error was:

... did not find expected key while parsing a block mapping at line 4 column 1 ...

The short answer is:  Indentation of your YAML is likely off.

At first, the problem wasn't obvious so I ran to Google for help.  My search turned up the following post on stackoverflow.com which has the answer but still required close inspection of the accepted response.

New to me but there is also a site you can use to confirm your YAML:  http://yamllint.com/
(note: It should be obvious but I'll spell it out, don't past YAML with your passwords into the lint site)

Hopefully this post helps you resolve something quickly.