2

When updating all Chocolatey packages, the following error message appears:

Root element is missing.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

chocolatey.log details

2020-05-19 11:44:14,947 22876 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2020-05-19 11:44:14,953 22876 [ERROR] - Root element is missing.
2020-05-19 11:44:14,958 22876 [ERROR] - More Details: System.Xml.XmlException: Root element is missing.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
   at NuGet.XmlUtility.LoadSafe(Stream input, Boolean ignoreWhiteSpace)
   at NuGet.Manifest.ReadFrom(Stream stream, IPropertyProvider propertyProvider, Boolean validateSchema)
   at NuGet.LocalPackage.ReadManifest(Stream manifestStream)
   at NuGet.UnzippedPackage.EnsureManifest(String manifestFilePath)
   at NuGet.LocalPackageRepository.OpenPackage(String path)
   at NuGet.LocalPackageRepository.GetPackage(Func`2 openPackage, String path)
   at NuGet.LocalPackageRepository.<GetPackages>d__28.MoveNext()
   at NuGet.CollectionExtensions.AddRange[T](ICollection`1 collection, IEnumerable`1 items)
   at NuGet.LocalPackageRepository.FindPackagesById(Func`2 openPackage, String packageId)
   at NuGet.PackageRepositoryExtensions.FindPackagesById(IPackageRepository repository, String packageId)
   at NuGet.PackageRepositoryExtensions.FindPackage(IPackageRepository repository, String packageId, SemanticVersion version, IPackageConstraintProvider constraintProvider, Boolean allowPrereleaseVersions, Boolean allowUnlisted)
   at chocolatey.infrastructure.app.services.NugetService.upgrade_run(ChocolateyConfiguration config, Action`1 continueAction, Boolean performAction, Action`1 beforeUpgradeAction)
   at chocolatey.infrastructure.app.services.NugetService.upgrade_run(ChocolateyConfiguration config, Action`1 continueAction, Action`1 beforeUpgradeAction)
   at chocolatey.infrastructure.app.services.ChocolateyPackageService.perform_source_runner_function[T](ChocolateyConfiguration config, Func`2 function)
   at chocolatey.infrastructure.app.services.ChocolateyPackageService.upgrade_run(ChocolateyConfiguration config)
   at chocolatey.infrastructure.app.runners.GenericRunner.run(ChocolateyConfiguration config, Container container, Boolean isConsole, Action`1 parseArgs)
   at chocolatey.infrastructure.app.runners.ConsoleApplication.run(String[] args, ChocolateyConfiguration config, Container container)
   at chocolatey.console.Program.Main(String[] args)

Version info

Tested with Chocolatey v0.10.15

2

Cause

Zero byte nupkgs or nuspec files cause this issue. These package files are downloaded from the Chocolatey nuget server and can be corrupted/empty, for example when the disk is full.

Workaround

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

Find and delete empty *.nu* files in this directory tree:

C:\ProgramData\chocolatey\lib

Source and issue status

Issue: https://github.com/chocolatey/choco/issues/717

1
  • You can remove those empty files using this PowerShell command ChildItem C:\ProgramData\chocolatey\lib\*\*.nu* | where Length -eq 0 | Del – scls Jan 3 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.