Intervention/image · error · Intervention\Image\Exceptions\FileNotFoundException

File "{basename}" contained in SplFileInfo is no file in dir

Error message

File "{basename}" contained in SplFileInfo is no file in directory "{dirname}"

What it means

Error "File "{basename}" contained in SplFileInfo is no file in directory "{dirname}"" thrown in Intervention/image.

Source

Thrown at src/Traits/CanParseFilePath.php:107

        if ($path === '') {
            throw new InvalidArgumentException('Path contained in SplFileInfo must not be an empty string');
        }

        if (!is_dir($dirname)) {
            throw new DirectoryNotFoundException(
                'The directory "' . $dirname . '" contained in SplFileInfo does not exist',
            );
        }

        if (!file_exists($path)) {
            throw new FileNotFoundException(
                'File "' . $basename . '" contained in SplFileInfo was not found in directory "' . $dirname . '"',
            );
        }

        if (!is_file($path)) {
            throw new FileNotFoundException(
                'File "' . $basename . '" contained in SplFileInfo is no file in directory "' . $dirname . '"',
            );
        }

        if (!is_readable($dirname)) {
            throw new FileNotReadableException(
                'Directory "' . $dirname . '" contained in SplFileInfo is not readable',
            );
        }

        if (!is_readable($path)) {
            throw new FileNotReadableException(
                'File "' . $path . '" contained in SplFileInfo is not readable',
            );
        }

        $realpath = $splFileInfo->getRealPath();

View on GitHub (pinned to 5598b9e397)

Solutions

  1. Ensure the SplFileInfo points to a regular file, not a directory or symlink to a directory; check isFile() first
  2. Filter directory iterators with isFile() before decoding entries
  3. Pass the file path directly if the SplFileInfo type is uncertain

When it happens

Trigger: Thrown at src/Traits/CanParseFilePath.php:107 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23). Data as JSON: /api/errors/f5e1de089bd56115. Report an issue: GitHub.