Puppet: Error 400 on SERVER ArgumentError: malformed format string – %S at …

Here’s an error to screw with your debugging skills.

~$ puppet agent -t
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb
...
Info: Loading facts in /var/lib/puppet/lib/facter/vmwaretools_version.rb
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: malformed format string - %S at /etc/puppet/manifests/yourhosntame.pp:13 on node [yournodename]
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

There’s probably nothing wrong with either the syntax or the data inside your manifests or modules. In fact, the line-number in the error could point you to a completely unrelated place in your code.

What’s more than likely to cause the problem is external data like hiera. If you’re using a yaml/xml/mysql backend, make sure the data in it is valid and not malformed. When using yaml, check the syntax and the encoding of all your entities and attributes.