I use Puppet for both business and pleasure and my work often involves writing custom Puppet facts to expose various bits of information.
Recently a fact I had written that worked on the development machines started throwing errors when run on our production machines:
Could not retrieve jethros_awesome_fact: nesting of 20 is too deep
After digging around it turns out this relates to how many nested levels are inside JSON responses. By default Ruby enforces a maximum level of nesting, I guess to avoid parsing bad JSON or JSON deliberately structured to cause infinite looping.
My fact involved pulling JSON from a local application API and then providing various bits of data from the feed. In the development environments this worked without an issue, but the production systems returned a lot more information via the API feed and broke it.
The fix is pretty easy, just need to add the :max_nesting => false parameter when parsing the JSON – or set it to a different number of levels if you prefer that approach.
json = JSON.parse(response.body, :max_nesting => false)