# Inconsistency in client\_key loading cli/knife

**URL:** <https://discourse.chef.io/t/inconsistency-in-client-key-loading-cli-knife/23537>\
**Category:** Chef Workstation\
**Created:** [December 7, 2024, 12:30am UTC](https://discourse.chef.io/t/inconsistency-in-client-key-loading-cli-knife/23537 "2024-12-07T00:30:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roland\_Moriz](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/roland_moriz/32/857_2.png) [@Roland\_Moriz](https://discourse.chef.io/u/Roland_Moriz)\
**Post date:** [December 7, 2024, 12:30am UTC](https://discourse.chef.io/t/inconsistency-in-client-key-loading-cli-knife/23537/1 "2024-12-07T00:30:14Z")

</div>

I'm still on a traditional layout working successfully with knife:

Layout

```auto
$WORKSPACE/.chef/knife.rb
$WORKSPACE/.chef/username.pem
$WORKSPACE/roles/
$WORKSPACE/cookbooks/
$WORKSPACE/nodes/
…

```

relevant contents $WORKSPACE/.chef/knife.rb

```auto
repo = '/path/to/workspace'

node_name 'rmoriz'
client_key "#{repo}/.chef/rmoriz.pem"

```

**no configs in ~./chef !**

Problems start with chef-cli when we evaluate Policyfiles.

what's working fine:

within $WORKSPACE

```auto
$ chef-cli show-policy
(result obmitted)

```

but within **$WORKSPACE/policyfiles** OR  
but within **$WORKSPACE/cookbooks/cookbook\_with\_policyfile**

```auto
$ chef-cli show-policy
[2024-12-07T01:22:43+01:00] WARN: Failed to read the private key rmoriz.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - rmoriz.pem>
Error: Failed to list policyfile data from the server
Reason: (Chef::Exceptions::PrivateKeyMissing) I cannot read rmoriz.pem, which you told me to use to sign requests!

```

Looks like the logic to find the config file is not sucessfully traversing and/or losing the configuration setting for the key (maybe `node_name` + `.pem` overwrites my config setting?)

It breaks the whole Policyfile workflow.

---

<div class="post-metadata">

**Author:** ![Stromweld](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/stromweld/32/3416_2.png) [@Stromweld](https://discourse.chef.io/u/Stromweld)\
**Post date:** [December 12, 2024, 4:42pm UTC](https://discourse.chef.io/t/inconsistency-in-client-key-loading-cli-knife/23537/2 "2024-12-12T16:42:05Z")

</div>

from within the policy files directory can you successfully run `knife status`? I'm guessing chef-cli isn't navigating the directories and is only looking or starting in $HOME/.chef. If knife works then that would be more evident that my theory is true, if not then it maybe another issue.

---

<div class="post-metadata">

**Author:** ![Roland\_Moriz](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/roland_moriz/32/857_2.png) [@Roland\_Moriz](https://discourse.chef.io/u/Roland_Moriz)\
**Post date:** [December 12, 2024, 10:59pm UTC](https://discourse.chef.io/t/inconsistency-in-client-key-loading-cli-knife/23537/3 "2024-12-12T22:59:00Z")

</div>

yes I can. Knife works.
