cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Zip archive with PowerShell "Error: The zip file may not be valid or may be an unsupported version."

LeoGriffM
New Contributor II

Zip archive "Error: The zip file may not be valid or may be an unsupported version."

We are trying to upload a ZIP archive to a Databricks workspace for faster and atomic uploads of artifacts. The expected behaviour is that we can run the following command to upload a zip file that is automatically unpacked into a Workspace directory. `databricks workspace import /Workspace/Shared/development/dbt/data_platform.zip --file C:\Users\...\data_platform\transformations\data_platform.zip --profile development --format AUTO` However, we get the error message "Error: The zip file may not be valid or may be an unsupported version." when compressing the archive via PowerShell. We have tried the `Compress-Archive` cmdlet and `[System.IO.Compression.ZipFile]::CreateFromDirectory()`. This error does not occur when we use Windows UI (right-click compress) or 7Zip.

I have reviewed documentation and blog posts but can't find any useful information. I've also raised a support ticket with Databricks.

Please share if you have insights, a fix or workaround for this! Thanks in advance.

2 REPLIES 2

LeoGriffM
New Contributor II

May relate to feature request https://github.com/databricks/cli/issues/1221

mark_ott
Databricks Employee
Databricks Employee

The error message "Error: The zip file may not be valid or may be an unsupported version" when importing a zip archive via the Databricks CLI is a known issue, especially with zip files created using PowerShell's Compress-Archive or [System.IO.Compression.ZipFile]::CreateFromDirectory() methods. This problem does not occur when using third-party tools like 7-Zip or the native Windows file explorer right-click compress feature.​

Why PowerShell Zips Fail

  • PowerShell's zip implementation often produces archives with metadata or file structure nuances that are technically valid but can be incompatible with some applications, including Databricks CLI's import logic.​

  • Databricks CLI appears to have stricter requirements about the zip file format (particularly central directory structure and possibly compression methods), which PowerShell's tools might not meet.​

  • There is ongoing discussion and feature requests about supporting zips from PowerShell, but as of the latest updates, these issues persist.​

Workarounds & Recommendations

  • Use the Windows File Explorer (“Send to > Compressed (zipped) folder”) or 7-Zip to create zip files for Databricks workspace imports.​

  • Avoid PowerShell and .NET zip creation utilities for these uploads, as their outputs may trigger compatibility errors.

  • If you require automation in your workflow, consider scripting with third-party CLI tools like 7-Zip via command line (7z a myzip.zip .) for zip creation.

Additional Notes

  • Databricks workspace import via CLI currently does not support all zip archive formats. Only zips with certain directory structures and compression methods may be accepted.​

  • You might also want to look for updates to the Databricks CLI or open feature requests on the official GitHub page as work is underway to improve compatibility.​

Summary Table

Zip Tool Compatible with Databricks Import Notes
PowerShell No Causes “unsupported version” error​
[System.IO.Compression] No Same as above​
Windows Explorer Yes “Send to > Compressed (zipped) folder”
7-Zip Yes CLI or GUI
 
 

To resolve your issue, always use Windows Explorer or 7-Zip for creating zip archives destined for Databricks workspace imports.​