getgrav/grav · error · InvalidArgumentException
ZipArchiver: {archive_file} cannot be created: {error}
Error message
ZipArchiver: {archive_file} cannot be created: {error} What it means
Error "ZipArchiver: {archive_file} cannot be created: {error}" thrown in getgrav/grav.
Source
Thrown at system/src/Grav/Common/Filesystem/ZipArchiver.php:296
throw new InvalidArgumentException('ZipArchiver: ' . $source . ' cannot be found...');
}
$zip = new ZipArchive();
$result = $zip->open($this->archive_file, ZipArchive::CREATE);
if ($result !== true) {
$error = 'unknown error';
if ($result === ZipArchive::ER_NOENT) {
$error = 'file does not exist';
} elseif ($result === ZipArchive::ER_EXISTS) {
$error = 'file already exists';
} elseif ($result === ZipArchive::ER_OPEN) {
$error = 'cannot open file';
} elseif ($result === ZipArchive::ER_READ) {
$error = 'read error';
} elseif ($result === ZipArchive::ER_SEEK) {
$error = 'seek error';
}
throw new InvalidArgumentException('ZipArchiver: ' . $this->archive_file . ' cannot be created: ' . $error);
}
$files = $this->getArchiveFiles($rootPath);
$status && $status([
'type' => 'count',
'steps' => iterator_count($files),
]);
foreach ($files as $file) {
$filePath = $file->getPathname();
$relativePath = ltrim(substr((string) $filePath, strlen($rootPath)), '/');
if ($file->isDir()) {
$zip->addEmptyDir($relativePath);
} else {
$zip->addFile($filePath, $relativePath);
}View on GitHub (pinned to 6040efed04)
When it happens
Trigger: Thrown at system/src/Grav/Common/Filesystem/ZipArchiver.php:296 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of getgrav/grav@6040efed04 (2026-08-17).
Data as JSON: /api/errors/64e9847c0001a0bd.
Report an issue: GitHub.