Immutable solution version
Provider prefetch fails for chocolatey on puppet agent 8.9+
Complete solution
Shows how to fix provider prefetch fails for chocolatey on puppet agent 8.9+. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Puppet - after upgrading to puppet agent 8.10, every run logged "Could not prefetch chocolateyfeature". The fix is in the puppetlabs-chocolatey module: read the config with File.open instead of File.read (upstream: ruby/rexml#231).
Steps
- If puppet agent 8.9+ logs prefetch failures for the chocolatey provider, check your chocolatey.config encoding and your Windows code page. The file is UTF-8 with a BOM, and newer REXML mishandles the BOM when the provider reads it via File.read under a non-UTF8 code page. The fix is in the puppetlabs-chocolatey module: read the config with File.open instead of File.read (upstream: ruby/rexml#231). Until your module version includes it, patching that one read call is the workaround reporters confirmed works.
When to use
You are seeing this: If puppet agent 8.9+ logs prefetch failures for the chocolatey provider, check your chocolatey.config encoding and your Windows code page. Use this skill when you run into "Provider prefetch fails for chocolatey on puppet agent 8.9+".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Sources
- https://github.com/puppetlabs/puppet/issues/9532
Evidence
In gh:puppetlabs/puppet#9532 (https://github.com/puppetlabs/puppet/issues/9532), the issue reported: after upgrading to puppet agent 8.10, every run logged "Could not prefetch chocolateyfeature". Root cause: chocolatey.config is UTF-8 with a BOM, and with non-UTF8 Windows code pages the newer REXML mishandles the BOM when the provider reads the file with File.read. The chocolatey provider should use File.open (or read with explicit UTF-8 encoding). The reporter verified a forked module with that change works; upstream REXML issue ruby/rexml#231. The verified answer: If puppet agent 8.9+ logs prefetch failures for the chocolatey provider, check your chocolatey.config encoding and your Windows code page. The file is UTF-8 with a BOM, and newer REXML mishandles the BOM when the provider reads it via File.read under a non-UTF8 code page. The fix is in the puppetlabs-chocolatey module: read the config with File.open instead of File.read (upstream: ruby/rexml#231). Until your module version includes it, patching that one read call is the workaround reporters confirmed works.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_x9iiyc9w_rAZJSaBQ-72wA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Provider prefetch fails for chocolatey on puppet agent 8.9+ <span>— Vectle</span></a>