moodle/moodle · error · PhpSpreadsheetException

File $path not found!

Error message

File $path not found!

What it means

Thrown by Drawing::setPath() as a final catch-all when $verifyFile is true and the image could not be resolved to an actual readable image. By this point setPath has tried three resolution strategies in order: downloading the URL to a temp file, locating the entry inside the provided ZipArchive ('archive.zip#entry' syntax), and plain file_exists() — each also requiring isImage() (mime check) to pass. The path property stays empty, so the faulty input is the $path argument: a dead URL, a missing zip member, a non-existent/moved file, or a file whose MIME type is not an image.

Solutions

  1. Verify the path exists and is a real image (mime starts with image/) before calling setPath().
  2. For zip members, pass the ZipArchive in the $zip argument and use the 'archive#entry' path form.
  3. For remote images, check the URL is reachable and downloadable, or call setPath($url, false) to skip verification.
  4. Re-upload or restore the missing image file and update the drawing path.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at public/lib/phpspreadsheet/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php:164 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of moodle/moodle@48ea8c3322 (2026-09-14). Data as JSON: /api/errors/bd89b7bbf0feeb40. Report an issue: GitHub.

Appendix: source

Thrown at public/lib/phpspreadsheet/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php:164

        if ($this->path === '' && $verifyFile) {
            throw new PhpSpreadsheetException("File $path not found!");
        }

        if ($this->worksheet !== null) {
            if ($this->path !== '') {
                $this->worksheet->getCell($this->coordinates);
            }
        }

View on GitHub (pinned to 48ea8c3322)