I run my server out of space and after that I got these messages when running cf-agent:
error: Could not open Tokyo database at path '/var/cfengine/cf_classes.tcdb'. (OpenTokyoDatabase: invalid record header) error: Could not write key to Tokyo path '/var/cfengine/state/cf_lock.tcdb'. (tchdbput: invalid record header)
To solve this problem first run these commands:
ls /var/cfengine/*.tcdb |xargs -n1 tchmgr optimize ls /var/cfengine/**/*.tcdb |xargs -n1 tchmgr optimize
If the problem persists remove the tcdb files and restart cfengine:
# rm /var/cfengine/state/cf_lock.tcdb rm /var/cfengine/state/cf_observations.tcdb rm /var/cfengine/cf_classes.tcdb
/etc/init.d/cfengine restart
There is an open issue in Cfengine 3 community