Without changing anything to the puppet configuration suddenly, some of our hosts started with "Could not evaluate: Field 'key' is required" errors, when creating exported SSH keys but interestingly not all SSH keys fail on all hosts, here one example where keys are both successfully and unsuccessfully created:
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for srvadx-green-7zhg.c.example.internal
Info: Applying configuration version '1511609586'
Notice: /Stage[main]/Basics::Ssh/Sshkey[srvadx-green-w5ld]/ensure: created
Info: Computing checksum on file /etc/ssh/ssh_known_hosts
Info: FileBucket got a duplicate file {md5}17787ff909a06cf0243c18cf33f1c384
Error: /Stage[main]/Basics::Ssh/Sshkey[srvadx-green-w5ld]: Could not evaluate: Field 'key' is required
Notice: /Stage[main]/Basics::Ssh/Sshkey[srvadx-green-88kp]/ensure: created
Error: /Stage[main]/Basics::Ssh/Sshkey[srvadx-green-88kp]: Could not evaluate: Field 'key' is required
Notice: /Stage[main]/Basics::Java/Exec[set-licence-selected]/returns: executed successfully
Notice: /Stage[main]/Basics::Java/Exec[set-licence-seen]/returns: executed successfully
Notice: Finished catalog run in 1.98 seconds
First I suspected a corrupt HSQLDB and deleted the whole puppetdb data directory and re-ran puppet on all hosts. First it looked promising, but soon the errors as above re-appeared.
How to debug or even better fix the problem and how to prevent it from happening again in the future?