octobercms/october · error · ApplicationException

The ZIP archive does not contain a data file (data.json or d

Error message

The ZIP archive does not contain a data file (data.json or data.csv)

What it means

Error "The ZIP archive does not contain a data file (data.json or data.csv)" thrown in octobercms/october.

Source

Thrown at modules/backend/models/importmodel/DecodesZip.php:73

            $candidatePath = $extractPath . '/' . $candidate;
            if (file_exists($candidatePath)) {
                $dataFile = $candidatePath;
                break;
            }
        }

        // Fallback: find any JSON or CSV file in the root
        if (!$dataFile) {
            foreach (File::files($extractPath) as $file) {
                if (in_array(strtolower(File::extension($file)), ['json', 'csv'])) {
                    $dataFile = $file;
                    break;
                }
            }
        }

        if (!$dataFile) {
            throw new ApplicationException(__("The ZIP archive does not contain a data file (data.json or data.csv)"));
        }

        // Auto-detect file format from the data file
        if (str_ends_with($dataFile, '.json')) {
            $this->file_format = 'json';
        }
        elseif (str_ends_with($dataFile, '.csv')) {
            $this->file_format = 'csv';
        }

        return $this->importDataFilePath = $dataFile;
    }

    /**
     * getImportFilesPath returns the directory path containing extracted
     * files from a ZIP import, or null if not a ZIP import
     */
    public function getImportFilesPath()

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/backend/models/importmodel/DecodesZip.php:73 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/261d8bd04ca6204d. Report an issue: GitHub.