# Chef env error

**URL:** <https://discourse.chef.io/t/chef-env-error/5703>\
**Category:** Chef Infra (archive)\
**Created:** [August 7, 2014, 5:36am UTC](https://discourse.chef.io/t/chef-env-error/5703 "2014-08-07T05:36:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Indra\_k](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@Indra\_k](https://discourse.chef.io/u/Indra_k)\
**Post date:** [August 7, 2014, 5:36am UTC](https://discourse.chef.io/t/chef-env-error/5703/1 "2014-08-07T05:36:40Z")

</div>

Hi all,

```
       I ve running java,windows chef_handler,powershell cookbook,mysql,openssl,it shows a following error :

```

my java code for env:  
#add java value in path variable

env “Path” do  
action :modify  
delim ::File::PATH\_SEPARATOR  
value node[‘java’][‘path’]  
not\_if {“Path”.include? node[‘java’][‘path’] }  
end

[2014-08-06T22:27:55-07:00] INFO: env[Path] created  
172.16.1.190  
[2014-08-06T22:27:55-07:00] INFO: Processing windows\_path[C:\Program  
Files\MySQL\MySQL Server 5.5\bin] action add (mysql::\_server\_windows  
line 7)  
172.16.1.190  
[2014-08-06T22:27:55-07:00] INFO: Processing env[PATH] action modify  
(c:/chef/cache/cookbooks/windows/providers/path.rb line 22)  
172.16.1.190  
172.16.1.190 ================================================================================

172.16.1.190 Error executing action `modify` on resource 'env[PATH]'  
172.16.1.190 ================================================================================  
172.16.1.190  
172.16.1.190 Chef::Exceptions::Env  
172.16.1.190 ---------------------  
172.16.1.190 Cannot modify env[PATH] - key does not exist!  
172.16.1.190  
172.16.1.190 Resource Declaration:  
172.16.1.190 ---------------------  
172.16.1.190 # In c:/chef/cache/cookbooks/windows/providers/path.rb  
172.16.1.190  
172.16.1.190 22: env “PATH” do  
172.16.1.190 23: action :modify  
172.16.1.190 24: delim ::File::PATH\_SEPARATOR  
172.16.1.190 25: value new\_resource.path  
172.16.1.190 26: end  
172.16.1.190 27: end  
172.16.1.190  
172.16.1.190 Compiled Resource:  
172.16.1.190 ------------------  
172.16.1.190 # Declared in c:/chef/cache/cookbooks/windows/providers/path.rb:22:in `block in class\_from\_file’  
172.16.1.190  
172.16.1.190 env(“PATH”) do  
172.16.1.190 action [:modify]  
172.16.1.190 retries 0  
172.16.1.190 retry\_delay 2  
172.16.1.190 guard\_interpreter :default  
172.16.1.190 key\_name "PATH"  
172.16.1.190 value "C:\Program Files\MySQL\MySQL Server 5.5\bin"  
172.16.1.190 delim ";"  
172.16.1.190 cookbook\_name "mysql"  
172.16.1.190 end  
172.16.1.190  
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Running queued delayed notifications before re-raising exception  
172.16.1.190 [2014-08-06T22:27:55-07:00] ERROR: Running exception handlers  
172.16.1.190  
[2014-08-06T22:27:55-07:00] ERROR: Exception handlers complete  
172.16.1.190 [2014-08-06T22:27:55-07:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out  
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Sending resource update report (run-id: fd53a514-74dc-4ba0-9966-f2c5ac75a436)  
172.16.1.190  
[2014-08-06T22:28:03-07:00] FATAL: Chef::Exceptions::Env: env[PATH]  
(c:/chef/cache/cookbooks/windows/providers/path.rb line 22) had an  
error: Chef::Exceptions::Env: Cannot modify env[PATH] - key does not  
exist!

Thanks,Indra

---

<div class="post-metadata">

**Author:** ![Adam\_Edwards1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/adam_edwards1/32/27_2.png) [@Adam\_Edwards1](https://discourse.chef.io/u/Adam_Edwards1)\
**Post date:** [August 7, 2014, 3:42pm UTC](https://discourse.chef.io/t/chef-env-error/5703/2 "2014-08-07T15:42:23Z")

</div>

Indra, you are hitting a known issue in Chef 11.14.2. The only workaround  
at the moment is to downgrade to Chef 11.12.8. We’re currently testing a  
fix for this issue as well: [https://github.com/opscode/chef/pull/1774](https://github.com/opscode/chef/pull/1774).

My apologies for the regression.

-Adam

_From:_ Indra k [[mailto:indra.k@cloudenablers.com](mailto:indra.k@cloudenablers.com)]  
_Sent:_ Wednesday, August 6, 2014 10:37 PM  
_To:_ [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
_Subject:_ [chef] chef env error

Hi all,

```
       I ve running java,windows chef_handler,powershell

```

cookbook,mysql,openssl,it shows a following error :

_my java code for env:_  
#add java value in path variable

env “Path” do  
action :modify  
delim ::File::PATH\_SEPARATOR  
value node[‘java’][‘path’]  
not\_if {“Path”.include? node[‘java’][‘path’] }  
end

# [2014-08-06T22:27:55-07:00] INFO: env[Path] created 172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Processing windows\_path[C:\Program Files\MySQL\MySQL Server 5.5\bin] action add (mysql::\_server\_windows line 7) 172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Processing env[PATH] action modify (c:/chef/cache/cookbooks/windows/providers/path.rb line 22) 172.16.1.190 172.16.1.190

# 172.16.1.190 Error executing action `modify` on resource 'env[PATH]' 172.16.1.190

172.16.1.190  
172.16.1.190 Chef::Exceptions::Env  
172.16.1.190 ---------------------  
172.16.1.190 Cannot modify env[PATH] - key does not exist!  
172.16.1.190  
172.16.1.190 Resource Declaration:  
172.16.1.190 ---------------------  
172.16.1.190 # In c:/chef/cache/cookbooks/windows/providers/path.rb  
172.16.1.190  
172.16.1.190 22: env “PATH” do  
172.16.1.190 23: action :modify  
172.16.1.190 24: delim ::File::PATH\_SEPARATOR  
172.16.1.190 25: value new\_resource.path  
172.16.1.190 26: end  
172.16.1.190 27: end  
172.16.1.190  
172.16.1.190 Compiled Resource:  
172.16.1.190 ------------------  
172.16.1.190 # Declared in  
c:/chef/cache/cookbooks/windows/providers/path.rb:22:in `block in  
class\_from\_file’  
172.16.1.190  
172.16.1.190 env(“PATH”) do  
172.16.1.190 action [:modify]  
172.16.1.190 retries 0  
172.16.1.190 retry\_delay 2  
172.16.1.190 guard\_interpreter :default  
172.16.1.190 key\_name "PATH"  
172.16.1.190 value "C:\Program Files\MySQL\MySQL Server 5.5\bin"  
172.16.1.190 delim ";"  
172.16.1.190 cookbook\_name "mysql"  
172.16.1.190 end  
172.16.1.190  
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Running queued delayed  
notifications before re-raising exception  
172.16.1.190 [2014-08-06T22:27:55-07:00] ERROR: Running exception handlers  
172.16.1.190 [2014-08-06T22:27:55-07:00] ERROR: Exception handlers complete  
172.16.1.190 [2014-08-06T22:27:55-07:00] FATAL: Stacktrace dumped to  
c:/chef/cache/chef-stacktrace.out  
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Sending resource update  
report (run-id: fd53a514-74dc-4ba0-9966-f2c5ac75a436)  
172.16.1.190 [2014-08-06T22:28:03-07:00] FATAL: Chef::Exceptions::Env:  
env[PATH] (c:/chef/cache/cookbooks/windows/providers/path.rb line 22) had  
an error: Chef::Exceptions::Env: Cannot modify env[PATH] - key does not  
exist!

Thanks,

Indra
