Intervention/image · error · Intervention\Image\Exceptions\FileNotFoundException
File "{basename}" contained in SplFileInfo was not found in
Error message
File "{basename}" contained in SplFileInfo was not found in directory "{dirname}" What it means
Error "File "{basename}" contained in SplFileInfo was not found in directory "{dirname}"" thrown in Intervention/image.
Source
Thrown at src/Traits/CanParseFilePath.php:101
*/
protected static function filePathFromSplFileInfoOrFail(SplFileInfo $splFileInfo): string
{
$path = $splFileInfo->getPathname();
$dirname = pathinfo($path, PATHINFO_DIRNAME);
$basename = pathinfo($path, PATHINFO_BASENAME);
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(View on GitHub (pinned to 5598b9e397)
Solutions
- Check SplFileInfo::isFile()/file_exists() before passing the object to the decoder
- Verify the path was not moved or deleted between constructing the SplFileInfo and reading it
- Use realpath or absolute paths to avoid relative-path resolution surprises
When it happens
Trigger: Thrown at src/Traits/CanParseFilePath.php:101 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/0775ecc326690473.
Report an issue: GitHub.