Chef-Client Error: Can’t Modify Frozen string

We found a new error yesterday when we tried to run a cookbook on a new node via Chef Server. 

Recipe: chef-client::task
* chef_client_scheduled_task[Chef Client] action add[2017-07-17T09:01:09-05:00] INFO: Processing chef_client_scheduled_task[Chef Client] action add (chef-client::task line 21)

Error executing action `add` on resource ‘chef_client_scheduled_task[Chef Client]’

can’t modify frozen String

Cookbook Trace:
c:/chef/cache/cookbooks/chef-client/resources/scheduled_task.rb:38:in `block in class_from_file’

This was the second node to test this cookbook on.  The first node was tested 3-4 weeks ago and it worked without issue.  So the first troubleshooting step was to rerun our integration tests via kitchen but all looked good.

The next step was to uninstall the chef-client from the target node and reboot the server because we weren’t sure if the chef-client had previously been installed and may have been interfering with the bootstrap process.  No dice.

The root cause

Finally, we realized that a newer chef-client version (13.2.20) had released since our last test.  This newer client was installed on the target node no problem but the error was occurring during the chef-client cookbook run.  This cookbook was installed on our Chef Server and was several versions old (7.2.0 but 8.1.7 was the latest). 

So the mismatch of a new chef-client executable and older chef-client cookbook was the root cause.  The first node continued to work fine because it has the older (12.18.31) chef-client installed.  The integration tests continued to work because it was pulling the latest chef-client cookbook from the marketplace instead of our Chef Server.

The Solution

The solution was to upload the newer version of the chef-client cookbook to the Chef Server.


I hope this post will help others with similar errors in the future.  If so or you have further questions please leave a comment below.

Leave a Reply