This message tells you that the catalog cannot be built. It is usually caused by puppet that can't parse the catalog and hence stops with this error. I've got this error for a long time and google never gave me any results. So I decided to chase this problem.

Analysis:
This problem only occurs when I'm at home, with my personal computer linked to my network company. Never had this with my company laptop.

Running the ENC command manually works flawlessly: Foreman node.rb api connection works (eg /etc/puppet/node.rb your.host.name)

Only got this problem when running the puppet agent manually on a node (eg: puppet agent -v --test)

Foreman retrieves facts and catalog from yaml files stored in /var/lib/puppet/yaml. There 3 directories in there: facts, foreman and node.

I typed the command

file node/*

And it gave me lot of ASCII files and few UTF-8 files. Why some of them contains UTF-8 characters? I opened the file and see the "last_run" variable with French accent in the value (mardi 18 février 2014, 18:52:45 (UTC+0100)). It's the last time puppet ran. When executed, puppet stores the localized date (because there is no locale override) and stops with error because it cannot handle UTF-8 for instance.

On my personal computer, OpenSSH client forwards LANG and LC_* environment variables when connecting. That's why the date is in French locale.

The short-term solution is to delete the yaml file.

It is also possible to change the way OpenSSH forwards envionment variables to remote host, especially the SendEnv parameter in /etc/ssh/ssh_client. You still need to remove yaml files.


Another solution, I did not test, is to execute puppet manually and forcing LC_ALL environment variable:

LC_ALL=C puppet agent -v --test