octobercms/october · error · ApplicationException

Failed to open the ZIP archive

Error message

Failed to open the ZIP archive

What it means

Error "Failed to open the ZIP archive" thrown in octobercms/october.

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 root

View on GitHub (pinned to b608633a7e)

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.