Error decrypting data bag value: 'bad decrypt'. Most likely the provided key is incorrect

Hi,

I recently Changed my password in existing data bag item and encrypted it while running chef-client one node, I am receiving ‘bad decrypt’. Error.

Recipe Compile Error in /home/vamsi/.chef/cache/cookbooks/artifact/resources/deploy.rb

Chef::EncryptedDataBagItem::DecryptionFailure

Error decrypting data bag value: ‘bad decrypt’. Most likely the provided key is incorrect.

Cookbook Trace:

/home/vamsi/.chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:289:in encrypted_data_bag_item' /home/vamsi/.chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:254:inencrypted_data_bag_for’
/home/vamsi/.chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:71:in data_bag_config_for' /home/vamsi/.chef/cache/cookbooks/artifact/libraries/chef_artifact_nexus_configuration.rb:12:infrom_data_bag’
/home/vamsi/.chef/cache/cookbooks/artifact/resources/deploy.rb:58:in `class_from_file’

Relevant File Content:

/home/vamsi/.chef/cache/cookbooks/artifact/libraries/chef_artifact.rb:

282: # @param data_bag_item [String]
283: #
284: # @raise [Chef::Artifact::DataBagEncryptionError] when the data bag cannot be decrypted
285: # or transformed into a Mash for some reason (Chef 10 vs Chef 11 data bag changes).
286: #
287: # @return [Chef::Mash]
288: def encrypted_data_bag_item(data_bag, data_bag_item)
289>> Mash.from_hash(Chef::EncryptedDataBagItem.load(data_bag, data_bag_item).to_hash)
290: rescue Net::HTTPServerException => e
291: nil
292: rescue NoMethodError
293: raise DataBagEncryptionError.new
294: end
295:
296: # Create and Write content of the “.symlinks” file. This file contains a reference
297: # to the reference of release version which “current” is pointing to.
298: #

Platform:

x86_64-linux

Running handlers:
[2016-07-06T12:12:23-06:00] ERROR: Running exception handlers
Running handlers complete
[2016-07-06T12:12:23-06:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 02 seconds
[2016-07-06T12:12:23-06:00] FATAL: Stacktrace dumped to /home/vamsi/.chef/cache/chef-stacktrace.out
[2016-07-06T12:12:23-06:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-07-06T12:12:23-06:00] ERROR: Error decrypting data bag value: ‘bad decrypt’. Most likely the provided key is incorrect.
[2016-07-06T12:12:23-06:00] FATAL: Chef::Exceptions::

if its in only one node, make sure the secret file for the decrypting the
data_bag is placed in it. I think the key exist under

/etc/chef/encrypted… <didn’t remember the exact name> by default.