{"record":{"id":"401289435a63a214","repo":"octobercms/october","slug":"the-image-is-not-found-on-the-disk","errorCode":null,"errorMessage":"The image is not found on the disk.","messagePattern":"The image is not found on the disk\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/media/widgets/MediaManager.php","lineNumber":1943,"sourceCode":"\n            if (!is_numeric($selectionData[$paramName])) {\n                throw new SystemException('Invalid selection data.');\n            }\n\n            $selectionData[$paramName] = (int) $selectionData[$paramName];\n        }\n\n        $sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey);\n        $fullSessionDirectoryPath = temp_path($sessionDirectoryPath);\n\n        if (!File::isDirectory($fullSessionDirectoryPath)) {\n            throw new SystemException('The image editing session is not found.');\n        }\n\n        // Find the image on the disk and resize it\n        $imagePath = $fullSessionDirectoryPath.'/'.$fileName;\n        if (!File::isFile($imagePath)) {\n            throw new SystemException('The image is not found on the disk.');\n        }\n\n        if (!$this->validateFileType($originalFileName)) {\n            throw new ApplicationException(Lang::get('backend::lang.media.type_blocked'));\n        }\n\n        $extension = pathinfo($originalFileName, PATHINFO_EXTENSION);\n\n        $targetImageName = basename($originalFileName, '.'.$extension).'-'\n            .$selectionData['x'].'-'\n            .$selectionData['y'].'-'\n            .$selectionData['w'].'-'\n            .$selectionData['h'].'-';\n\n        $targetImageName .= time();\n        $targetImageName .= '.'.$extension;\n\n        $targetTmpPath = $fullSessionDirectoryPath.'/'.$targetImageName;","sourceCodeStart":1925,"sourceCodeEnd":1961,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/media/widgets/MediaManager.php#L1925-L1961","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Always run the popup-open/resize step first and crop using the exact filename the previous response returned.","Match the extension exactly (original.<ext> uses the source path's extension) and beware case sensitivity on Linux.","Reopen the crop popup to regenerate a consistent session key and staged files."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Only crop a file the server told you about\nif (!stagedFiles.includes(image)) {\n    throw new Error(`Unknown crop source: ${image}`);\n}\n$.request('crop', { data: { image, ... } });","typeGuard":"function isKnownStagedFile(name, stagedFiles) {\n    return stagedFiles.includes(name);\n}","tryCatchPattern":null,"preventionTips":["Use the exact filename returned by the popup-open/resize response.","Avoid multi-tab crop sessions sharing one key.","Match file extension case exactly on case-sensitive filesystems."],"tags":["media-manager","crop","file-not-found","session"],"backgroundTag":"file-not-found","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}