chef-infra

Unable to run a recipe in chef as it says No such cookbook


I tried to run the recipe like this and getting an error I ran with absolute path an with other flags as well but no help There are multipe solutions available in stack overflow which I already tried. I seek your suggestions. Thanks in Advance.

[root@ip-17-188 cookbooks]# chef-client -zr recipe"[test-cookbook::recipe1]"
[2024-03-01T19:57:51+00:00] WARN: No config file found or specified on command line. Using 
command line options instead.

Chef Infra Client, version 17.6.18
Patents: https://www.chef.io/patents
Infra Phase starting
Resolving cookbooks for run list: ["test-cookbook::recipe1"]

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: test-cookbook

Expanded Run List:
------------------
* test-cookbook::recipe1

System Info:
------------
chef_version=17.6.18
platform=amazon
platform_version=2023
ruby=ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
program_name=/usr/bin/chef-client
executable=/opt/chef-workstation/bin/chef-client


Running handlers:
[2024-03-01T19:57:54+00:00] ERROR: Running exception handlers
Running handlers complete
[2024-03-01T19:57:54+00:00] ERROR: Exception handlers complete
Infra Phase failed. 0 resources updated in 02 seconds
[2024-03-01T19:57:54+00:00] FATAL: Stacktrace dumped to /root/.chef/local-mode
cache/cache/chef-stacktrace.out
[2024-03-01T19:57:54+00:00] FATAL: 
---------------------------------------------------------------------------------------

[2024-03-01T19:57:54+00:00] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out 
FILE   (above) IF YOU FILE A BUG REPORT

[2024-03-01T19:57:54+00:00] FATAL:
---------------------------------------------------------------------------------------
[2024-03-01T19:57:54+00:00] FATAL: Net::HTTPServerException: 412 "Precondition Failed"

Solution

  • The issue is fixed after upgrading the chef workstation.

    Older version:
    
    [root@ip-172-12-12-43 ec2-user]# chef --version
    Chef Workstation version: 21.10.640
    Chef Infra Client version: 17.6.18
    Chef InSpec version: 4.46.13
    Chef CLI version: 5.4.2
    Chef Habitat version: 1.6.351
    Test Kitchen version: 3.1.0
    Cookstyle version: 7.25.6
    
    Newer Version:
    [root@ip-172-12-12-43 cookbooks]# chef --version
    Chef Workstation version: 24.2.1058
    Test Kitchen version: 3.6.0
    Cookstyle version: 7.32.7
    Chef Infra Client version: 18.3.0
    Chef InSpec version: 5.22.40
    Chef CLI version: 5.6.14
    Chef Habitat version: 1.6.652