Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If a nupkg/nuspec is corrupt, do not fail trying to read it #717

Open
ferventcoder opened this issue May 1, 2016 · 13 comments
Open

If a nupkg/nuspec is corrupt, do not fail trying to read it #717

ferventcoder opened this issue May 1, 2016 · 13 comments

Comments

@ferventcoder
Copy link
Member

ferventcoder commented May 1, 2016

There may have been a network issue. Related to #198.

Zero byte nupkgs or nuspec files will give an issue like "Root element is missing".

Workaround

Find and remove the zero byte file and that should fix the issue. This is a manual workaround until Chocolatey can handle this.

@ferventcoder
Copy link
Member Author

@DarwinJS can you get me details on this one again? I just attempted to recreate this and was unable to.

@ferventcoder ferventcoder modified the milestones: 0.9.10.1, 0.9.10 May 30, 2016
@DarwinJS
Copy link
Contributor

If I remember correctly the file was truncated and the install failed.
Then when trying to install again it would not redownload (because the file
passes an existence check?), but then would choke on the incomplete file.
So kind of a catch 22 if you don't know what to delete. Maybe it is
important that the type of file corruption is a truncation?

D.
On May 30, 2016 3:42 PM, "Rob Reynolds" [email protected] wrote:

@DarwinJS https://github.com/DarwinJS can you get me details on this
one again? I just attempted to recreate this and was unable to.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#717 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ALD1hnHHAHS-YC0vaj82P84egnpimxkdks5qGz3AgaJpZM4IUDoO
.

@marcinbojko
Copy link

Hit by the same issue - out of space on one of dev servers, downloaded nupkg/nuspec files were broken (0 in lenght).

@ferventcoder ferventcoder modified the milestones: 0.10.10, 0.10.11 Mar 27, 2018
@masgo
Copy link

masgo commented Apr 30, 2018

I suggest starting with a more useful error message. "Root element is missing" is not very helpful. Maybe make it something like: "Root element is missing. Probably the nupkg file is broken. You can try to delete it by (add some command to chocolatey which just deletes everything) and start over." This would solve the issues for many users.

Later™, you could do a more sophisticaed/automated solution.

@ferventcoder
Copy link
Member Author

@masgo I completely agree with better/more actionable errors - it's a constant struggle when you use libraries that don't share this same idea.

@ferventcoder
Copy link
Member Author

Note for the implementer - take a look at #1829 as well.

@gep13 gep13 modified the milestones: 0.10.15, 0.10.16 May 31, 2019
@ferventcoder ferventcoder modified the milestones: 0.10.16, 0.10.17 Jan 15, 2020
@jawn
Copy link

jawn commented May 19, 2020

To make it easier to discover, I documented the issue and workaround on superuser.com.

@ferventcoder
Copy link
Member Author

Thanks for doing that @jawn!

@s-celles
Copy link

s-celles commented Jan 3, 2021

For those who also encounter this zero size file bug, you can remove them using this PowerShell command.

ChildItem C:\ProgramData\chocolatey\lib\*\*.nu* | where Length -eq 0 | Del

@ferventcoder ferventcoder modified the milestones: 0.10.17, 0.10.x Apr 14, 2021
@Chirishman
Copy link

Ran into this again today when trying to upgrade the mediainfo package, kept getting

2022-02-08 04:29:20,338 18004 [ERROR] - chocolatey not upgraded. An error occurred during installation: Unable to read package from path 'imagemagick.app\imagemagick.app.nupkg'.

Then when I removed the imagemagick.app folder from lib I started getting "root element is missing" until I ran @scls19fr's cleanup script.

+1 to this being handled more gracefully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants