{"record":{"id":"64e9847c0001a0bd","repo":"getgrav/grav","slug":"ziparchiver-archive-file-cannot-be-created-er","errorCode":null,"errorMessage":"ZipArchiver: {archive_file} cannot be created: {error}","messagePattern":"ZipArchiver: (.+?) cannot be created: (.+?)","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Common/Filesystem/ZipArchiver.php","lineNumber":296,"sourceCode":"            throw new InvalidArgumentException('ZipArchiver: ' . $source . ' cannot be found...');\n        }\n\n        $zip = new ZipArchive();\n        $result = $zip->open($this->archive_file, ZipArchive::CREATE);\n        if ($result !== true) {\n            $error = 'unknown error';\n            if ($result === ZipArchive::ER_NOENT) {\n                $error = 'file does not exist';\n            } elseif ($result === ZipArchive::ER_EXISTS) {\n                $error = 'file already exists';\n            } elseif ($result === ZipArchive::ER_OPEN) {\n                $error = 'cannot open file';\n            } elseif ($result === ZipArchive::ER_READ) {\n                $error = 'read error';\n            } elseif ($result === ZipArchive::ER_SEEK) {\n                $error = 'seek error';\n            }\n            throw new InvalidArgumentException('ZipArchiver: ' . $this->archive_file . ' cannot be created: ' . $error);\n        }\n\n        $files = $this->getArchiveFiles($rootPath);\n\n        $status && $status([\n            'type' => 'count',\n            'steps' => iterator_count($files),\n        ]);\n\n        foreach ($files as $file) {\n            $filePath = $file->getPathname();\n            $relativePath = ltrim(substr((string) $filePath, strlen($rootPath)), '/');\n\n            if ($file->isDir()) {\n                $zip->addEmptyDir($relativePath);\n            } else {\n                $zip->addFile($filePath, $relativePath);\n            }","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Filesystem/ZipArchiver.php#L278-L314","documentation":"Error \"ZipArchiver: {archive_file} cannot be created: {error}\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Filesystem/ZipArchiver.php:296 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6040efed04efa69b8209448ed81308e7c24147c2","analyzedAt":"2026-08-17T05:07:31.593Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}