octobercms/october · error · ApplicationException

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

Error message

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

What it means

Thrown after the import ZIP was extracted successfully but neither the expected data file (data.json or data.csv in the known candidate paths) nor any fallback JSON/CSV file was found in the extraction root. The archive opened fine; its contents simply do not match the expected export layout.

Solutions

  1. Ensure the archive was produced by the matching export feature and contains data.json or data.csv at the expected location
  2. If building the ZIP manually, place a data.json or data.csv file in the archive root
  3. Regenerate the export file from the source system instead of hand-assembling the ZIP
Defensive patterns

Strategy: validation

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.

Appendix: 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)