octobercms/october · error · SystemException

The image is not found on the disk.

Error message

The image is not found on the disk.

What it means

SystemException thrown in cropImage() (MediaManager.php:1943) when the session directory exists but the specific image file ($fileName from imageSrcPath, e.g. 'original.jpg' or 'resized-800-600.jpg') is not present in it. Distinct from error 595: here the session survived but this particular file does not exist inside it.

Source

Thrown at modules/media/widgets/MediaManager.php:1943

            if (!is_numeric($selectionData[$paramName])) {
                throw new SystemException('Invalid selection data.');
            }

            $selectionData[$paramName] = (int) $selectionData[$paramName];
        }

        $sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey);
        $fullSessionDirectoryPath = temp_path($sessionDirectoryPath);

        if (!File::isDirectory($fullSessionDirectoryPath)) {
            throw new SystemException('The image editing session is not found.');
        }

        // Find the image on the disk and resize it
        $imagePath = $fullSessionDirectoryPath.'/'.$fileName;
        if (!File::isFile($imagePath)) {
            throw new SystemException('The image is not found on the disk.');
        }

        if (!$this->validateFileType($originalFileName)) {
            throw new ApplicationException(Lang::get('backend::lang.media.type_blocked'));
        }

        $extension = pathinfo($originalFileName, PATHINFO_EXTENSION);

        $targetImageName = basename($originalFileName, '.'.$extension).'-'
            .$selectionData['x'].'-'
            .$selectionData['y'].'-'
            .$selectionData['w'].'-'
            .$selectionData['h'].'-';

        $targetImageName .= time();
        $targetImageName .= '.'.$extension;

        $targetTmpPath = $fullSessionDirectoryPath.'/'.$targetImageName;

View on GitHub (pinned to b608633a7e)

Solutions

  1. Always run the popup-open/resize step first and crop using the exact filename the previous response returned.
  2. Match the extension exactly (original.<ext> uses the source path's extension) and beware case sensitivity on Linux.
  3. Reopen the crop popup to regenerate a consistent session key and staged files.
Defensive patterns

Strategy: validation

Validate before calling

// Only crop a file the server told you about
if (!stagedFiles.includes(image)) {
    throw new Error(`Unknown crop source: ${image}`);
}
$.request('crop', { data: { image, ... } });

Type guard

function isKnownStagedFile(name, stagedFiles) {
    return stagedFiles.includes(name);
}

Prevention

When it happens

Trigger: Posting an image filename that was never staged in that session (wrong key + filename combination), a resized variant that was never generated, or a filename whose file was already cleaned up or overwritten between the resize and crop steps.

Common situations: Custom crop flows that skip the initial 'open popup' staging request and jump straight to crop with a hand-built filename; concurrent tabs sharing a session key while one closes it; a filename that differs only by extension case on case-sensitive filesystems.

Related errors


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/401289435a63a214. Report an issue: GitHub.