Puppet: Error: Could not retrieve catalog from remote server: Error 400 on SERVER: stack level too deep on node something.pp

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, June 13, 2013

Follow me on Twitter as @mattiasgeniar

As a Puppet user, you can run into the following error.

~$ puppet agent -t
Info: Retrieving plugin
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/iptables_persistent_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/ip6tables_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/iptables_version.rb
Info: Loading facts in /etc/puppet/modules/vmwaretools/lib/facter/vmwaretools_version.rb
Info: Loading facts in /etc/puppet/modules/postgresql/lib/facter/postgres_default_version.rb
Info: Loading facts in /etc/puppet/modules/concat/lib/facter/concat_basedir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/iptables_persistent_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/ip6tables_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/vmwaretools_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/postgres_default_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/iptables_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: stack level too deep on node hostname.tld
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

The error Error 400 on SERVER: stack level too deep on node can be caused by many things. Most likely cause appears to be this bug report : Puppet master fails with ‘stack level too deep’ error when storeconfigs = true with rails stack 3.1.0.

The proposed patch seems to work in our case.

--- resource.rb.old	2012-07-24 12:56:33.558553439 -0500
+++ resource.rb	2012-07-24 12:57:19.697566347 -0500
@@ -84,7 +84,11 @@
   end
 
   def [](param)
-    super || parameter(param)
+    if param == 'id'
+      super
+    else
+      super || parameter(param)
+    end
   end
 
   # Make sure this resource is equivalent to the provided Parser resource.

The file is /usr/lib/ruby/site_ruby/1.8/puppet/rails/resource.rb. Edit to file according to the patch above and restart your Puppet Master. Additionally, check which version your activerecord gem is.

~$ gem list | grep activerecord
activerecord (3.0.11, 3.0.10)

Make sure only version 3.0.10 is installed.

~$ gem install activerecord -v 3.0.10

If a new gem is installed, restart the Puppetmaster as well.



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.