Title: Chef zero can't find cookbook during kitchen test run
Tags: chef-infra;cookbook
Question: This is driving me crazy, I just started using chef on a fresh image (win10), and for some reason when using kitchen to test a cookbook it can not find the cookbook? tried the response to this question: Chef solo can&#39;t find cookbook during kitchen test run
and it throws an error saying "Your Berksfile contains multiple entries named 'printserver'. Please remove duplicate dependencies, or put them in different groups.] on default-win-2012r2-standard-amd64-nocm"
Kitchen version 1.17.0
----&gt; Converging <default-win-2012r2-standard-amd64-nocm&gt;...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 6.3.1...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----&gt; Chef Omnibus installation detected (install only if missing)
Transferring files to <default-win-2012r2-standard-amd64-nocm&gt;
Starting Chef Client, version 13.4.24
resolving cookbooks for run list: ["printserver"]
================================================================================
Error Resolving Cookbooks for Run List:
================================================================================
Missing Cookbooks:
------------------
No such cookbook: printserver
Expanded Run List:
------------------
* printserver
System Info:
------------
chef_version=13.4.24
platform=windows
platform_version=6.3.9600
ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x64-mingw32]
program_name=C:/opscode/chef/bin/chef-client
executable=C:/opscode/chef/bin/chef-client
Running handlers:
[2017-09-20T13:38:53-07:00] ERROR: Running exception handlers
Running handlers complete
[2017-09-20T13:38:53-07:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 03 seconds
[2017-09-20T13:38:53-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2017-09-20T13:38:53-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-09-20T13:38:53-07:00] FATAL: Net75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0HTTPServerException: 412 "Precondition Failed"
------Exception-------
Class: Kitchen75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0tionFailed
Message: 1 actions failed.
Converge failed on instance <default-win-2012r2-standard-amd64-nocm&gt;.
Please see .kitchen/logs/default-win-2012r2-standard-amd64-nocm.log for more details
Please see .kitchen/logs/kitchen.log for more details
Also try running `kitchen diagnose --all` for configuration
Comment: Please add in the Berksfile and metadata.rb which are in the same folder as you are running that command.

Here is the accepted answer: What I ended up doing in order:
Took cookbook from work laptop to home PC and tested, worked as expected.
Uninstalled chef, vagrant and virtual box and reinstalled with same versions on home PC, still same problem.
At this point was annoyed with how much time I had spent trying to fix this so I re-imaged the laptop and re installed everything again (newest versions) and it now works correctly as it should.
What went wrong in the first place? I have no clue.
On a side note if anyone has any good references for creating a windows 2012 print server with chef, would be very helpful.

Here is another answer: i resolved this by adding a metadata line to Berksfile.

Here is another answer: Add the following to Berksfile (under "metadata"):
cookbook 'printserver'
For clarification: if this is a cookbook that you created, you will need to do a few things:
if you have the cookbook locally, you will need to add path: '../printserver/' or something like that.  It will need to be relative to the current path.
If it is on github, add something like git: 'melanie03@example.org/my_org/printserver.git', 'master'
So, putting all that together, to use relative path on your local system:
cookbook 'printserver', path: '../printserver'
For git:
cookbook 'printserver', git: 'melanie03@example.org/your_org/printserver.git', 'master'
Finally, run berks install. If it still gives issues, let me know.
Comment for this answer: This is probably not correct, deps should be in the metadata.rb but it's hard to say without more info
Comment for this answer: You're incorrect, @InsertNameHere -- it is in his runlist, but cannot be found, which means it is missing in the Berksfile.
Now, this appears to be an internal cookbook (not from the community), therefore you need to provide a Git origin for it, or a local path (relative to where the cookbook is that you're running it from).

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 3, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:09/20/17', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<chef-infra><cookbook>', 'Title': "Chef zero can't find cookbook during kitchen test run", 'ViewCount': 897, 'id': 46331779, 'user_AboutMe': '', 'user_AccountId': 8035542.0, 'user_DisplayName': 'InsertNameHere', 'user_Reputation': 21.0, 'user_Views': 9.0, 'user_id': 6058800.0}}