Purpose
When running a deployment, the deployment fails with the following error.
Download failed: invalid Zip archive: Could not find central directory
Cause
This error can be seen when working with zip file attachments on a Script step or Install step. Ordinarily, both Install and Script steps can make use of archive files with a .zip extension as attachments, and the Connect agent will automatically extract them prior to running the command.
This error occurs when trying to extract files from a zip archive where the central directory signature is missing or corrupted. Possible causes are:
- The attached zip file is corrupt.
- The file has an extension of .zip but is not a true zip file.
Resolution
Verify the validity of zip files before attaching them to a package step. If an archive file was created using a different archive format (.7z, .rar, etc.), simply renaming the file extension to .zip will not allow you to use it as a zip file - taking this action will result in the invalid Zip archive error above. Instead, you would need to open the archive in the appropriate archive software (7-Zip, WinRAR, etc.) and re-save the file as a valid .zip file.
Additionally, ensure that the zip file is fully intact and not corrupt. The easiest way to test zip file integrity is to extract it to a location manually before uploading it to a PDQ Connect package. If the zip file can be extracted in Windows without errors, the same results should also be seen during the deployment.