Fixing the Chocolatey Deserializing Error

Error deserializing response of type chocolatey.infrastructure.app.domain.PackageFiles:

This is just a quick post to help people having an issue with chocolatey. For those of you who don’t know what chocolatey is, you can read more about it here as well as watching a quick video i put together on how to install it. You can find that here too.

I recently was in the middle of upgrading packages on my laptop using chocolatey when Windows decided to crash on me. To be honest, I can’t remember the last time it gave out. I was trying to render a video as well as downloading some stuff so I think my poor lenovo basically ran out of steam. Anyway, I restarted the laptop and went back to Powershell (as admin). I went to resume my update using the following command:

cup all -y

As soon as I hit enter, the upgrade script kicked off, but i immediately started to receive the following errors:

Error deserializing response of type chocolatey.infrastructure.app.domain.PackageFiles:
Error deserializing response of type chocolatey.infrastructure.app.domain.PackageFiles:

No matter what i did to try and fix it, I was stuck. I was pouring through google and Github looking for others who’d had similar issues.

It looks like there were a few that had similar problems. Some of the responses or supposed fixes were the following:

It appears that one of my xml files had been corrupted (probably was mid-write when it crashed).

I tried to delete the following files and restarting:

C:\ProgramData\chocolatey\lib\chocolatey\chocolatey.nupkg

C:\ProgramData\chocolatey\lib\chocolatey\chocolatey.nupkg\chocolatey.nuspec

Neither of these did the trick.

I tried reinstalling Chocolatey using the following command:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1’))

It made no difference. I next went to the following folder and started to clear out some of the older package files (i.e I had evernote 1.x, evernote 2.x, evernote 3.x: I just deleted the previous versions and left the latest).

C:\ProgramData\chocolatey\lib

This also had no effect. I also tried the following script (I created a text file on the desktop and saved it as choco.txt):

https://chocolatey.org/docs/troubleshooting#a-corrupt-registry-file-exists
https://chocolatey.org/docs/troubleshooting#a-corrupt-registry-file-exists

This also didn’t work to fix the issue (I ran it as admin). Having run out of steps, I began to look more closely at the issue. If I ignored the first error but looked at where the error came back it always sat between rufus and syncthing. I decided to delete out rufus entirely from the drive. I deleted it from here:

C:\ProgramData\chocolatey\lib

This didn’t fix the issue, so I restored it. Next I thought I would try to delete syncthing. Again, located here: C:\ProgramData\chocolatey\lib

I deleted the syncthing folder and ran the following command:

cup all -y

Bingo! Error gone. So it looks to me like it was doing something with the syncthing package when the laptop crashed and the process failed.

I then proceeded to reinstall syncthing with the following command:

choco install syncthing -y

I have since restarted, and repeatedly moved to update packages. Everything is working as it should and all is right with the world!

Hope this helps fix you up.

Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *