Thomas McGoey-Smith

Did not expect key while parsing yaml

I’ve been in the process of building out a proper test suite to Has It Shipped Yet, and one of the problems I ran into was fixing a small yaml parsing error.

In particular this error:

did not expect key while parsing yaml

Unfortunately when running rake test I was met this this cryptic error:

Psych::SyntaxError: (<unknown>): did not find expected key while parsing a block mapping at line 10 column 2

Luckily I was able to stumble upon this GitHub issue.

It turns out that Psych doesn’t have the greatest error messages, so I looked out for a simple yaml validator and case across this Code Beautify’s YAML Validator.

I was able to narrow done the issue down to the line number.

Hope that helps.

@tamcgoey on Feb 08, 2016

Enjoyed the article? Subscribe to my newsletter for more.

© Thomas McGoey-Smith (2014-2018). RSS.