Template 404 "Not Found" thrown with Chef Client 13 Local Mode



I raised a bug several months ago on github that was happening with Template resources in Chef Client 13 local mode but didn’t receive a reply so though it worth asking here.

I was trying this again with the latest chef-client version today to see if the issue still persisted and it does. Essentially whenever my run hits a template resource it fails with the error on the bug (reposted below for convenience).

  * template[/var/www/html/index.php] action create

    Error executing action `create` on resource 'template[/var/www/html/index.php]'

    404 "Not Found"

    Resource Declaration:

    Compiled Resource:
    # Declared in /root/.chef/local-mode-cache/cache/cookbooks/splash-page/recipes/install-splash-page.rb:34:in `from_file'

    template("/var/www/html/index.php") do
      action [:create]
      default_guard_interpreter :default
      source "index.php.erb"
      declared_type :template
      cookbook_name "splash-page"
      recipe_name "install-splash-page"
      owner "user"
      group "apache"
      mode "0755"
      path "/var/www/html/index.php"
      verifications []

    System Info:
    ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
    program_name=chef-client worker: ppid=1588;start=17:08:09;

And the specific error in debug mode:

[2017-07-19T15:35:35+01:00] DEBUG: #<ChefZero::RestRequest:0x00000006d710f8
 @rest_base_prefix=["organizations", "chef"],
 @rest_path=["organizations", "chef"]>

[2017-07-19T15:35:35+01:00] DEBUG: #<ChefZero::RestErrorResponse: 404: Object not found: chefzero://localhost:1/org>

Any help on this would be really appreciated. We’re having to keep several machines on Chef Client 12 (which works perfectly) and would love to get them updated before it hits EOL.

Many Thanks,


Hi @Ryuzaki,

To be honest I never used chef-zero before and probably I am not the best to give advice here, but the problem looks interesting…
Are you running chef-zero command with sudo privileges? Does the same error occur if running chef-solo?


Well we’re using chef-client with the --local-mode flag so it’ll be chef-zero according to the docs - https://docs.chef.io/ctl_chef_client.html.

We are indeed running it with sudo also. An interesting twist is that it all works fine in our Test Kitchens. It’s just when using chef-client --local-mode.


Do you think you can create a minimal failing example of this cookbook? Like strip everything from the cookbook but the template and share it with us? To really solve the problem it would also help to know the exact chef-client command you are calling with all options (just replace the ones with sensitive information with some dummy values).


I think it’s worth moving this to the bug @Ryuzaki mentioned in their first post.