octobercms/october · error · ApplicationException
Failed to open the ZIP archive
Error message
Failed to open the ZIP archive
What it means
Thrown during import when ZipArchive::open() returns a non-true result code for the uploaded import archive. The zip file could not be opened at all — it is missing, unreadable, corrupt, empty, or not a valid ZIP, so extraction cannot proceed.
Solutions
- Re-download or re-export the import ZIP and retry the import
- Verify the file uploaded completely (check its size and that it opens in another archive tool)
- Inspect the specific ZipArchive::open() return code (e.g. ZipArchive::ER_NOZIP, ER_CORRUPT) to distinguish a bad format from a permissions problem
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at modules/backend/models/importmodel/DecodesZip.php:44 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/5baa282d488129d7.
Report an issue: GitHub.
Appendix: source
Thrown at modules/backend/models/importmodel/DecodesZip.php:44
*/
protected $pathPrefix;
/**
* extractImportZip extracts a ZIP archive and returns the path to the
* data file inside. Also sets importFilesPath for file attachment resolution.
*/
protected function extractImportZip($zipPath)
{
// Return cached result if already extracted
if ($this->importDataFilePath !== null) {
return $this->importDataFilePath;
}
$extractPath = temp_path('import/' . uniqid('oc'));
$zip = new \ZipArchive;
if ($zip->open($zipPath) !== true) {
throw new ApplicationException(__("Failed to open the ZIP archive"));
}
$zip->extractTo($extractPath);
$zip->close();
$this->importFilesPath = $extractPath;
// Look for data file in the ZIP root
$dataFile = null;
foreach (['data.json', 'data.csv'] as $candidate) {
$candidatePath = $extractPath . '/' . $candidate;
if (file_exists($candidatePath)) {
$dataFile = $candidatePath;
break;
}
}
// Fallback: find any JSON or CSV file in the rootView on GitHub (pinned to b608633a7e)