crater-invoice-inc/crater · error · Exception

Zip file not found

Error message

Zip file not found

What it means

ModuleInstaller::unzip throws a generic sentinel Exception when the zip archive path passed in does not exist on disk — i.e. the earlier download/save step (file_put_contents of upload.zip) failed silently and returned false instead of a valid path.

Solutions

  1. Verify the download/save step succeeded and that it returned the zip path before calling unzip
  2. Check storage permissions and disk space for the temp directory
  3. Wrap the unzip call in try-catch and report 'module download failed' to the user instead of the raw exception
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at app/Space/ModuleInstaller.php:147 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of crater-invoice-inc/crater@05d5ce26fd (2026-09-13). Data as JSON: /api/errors/0146cfaf89580e28. Report an issue: GitHub.

Appendix: source

Thrown at app/Space/ModuleInstaller.php:147

        $zip_file_path = $temp_dir.'/upload.zip';

        // Add content to the Zip file
        $uploaded = is_int(file_put_contents($zip_file_path, $data)) ? true : false;

        if (! $uploaded) {
            return false;
        }

        return [
            'success' => true,
            'path' => $zip_file_path
        ];
    }

    public static function unzip($module, $zip_file_path)
    {
        if (! file_exists($zip_file_path)) {
            throw new \Exception('Zip file not found');
        }

        $temp_extract_dir = storage_path('app/temp2-'.md5(mt_rand()));

        if (! File::isDirectory($temp_extract_dir)) {
            File::makeDirectory($temp_extract_dir);
        }
        // Unzip the file
        $zip = new ZipArchive();

        if ($zip->open($zip_file_path)) {
            $zip->extractTo($temp_extract_dir);
        }

        $zip->close();

        // Delete zip file
        File::delete($zip_file_path);

View on GitHub (pinned to 05d5ce26fd)