{"record":{"id":"7d0f1ec1423e5e26","repo":"octobercms/october","slug":"invalid-hash","errorCode":null,"errorMessage":"Invalid hash","messagePattern":"Invalid hash","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/backend/controllers/Files.php","lineNumber":190,"sourceCode":"            throw new ApplicationException('File not found');\n        }\n\n        // Ensure that the file model utilized for this request is\n        // the one specified in the relationship configuration\n        if ($file->attachment) {\n            $fileModel = $file->attachment->{$file->field}()->getRelated();\n\n            // Only attempt to get file model through its assigned class\n            // when the assigned class differs from the default one that\n            // the file has already been loaded from\n            if (get_class($file) !== get_class($fileModel)) {\n                $file = $fileModel->find($file->id);\n            }\n        }\n\n        $verifyCode = self::getUniqueCode($file);\n        if ($code != $verifyCode) {\n            throw new ApplicationException('Invalid hash');\n        }\n\n        /**\n         * @event backend.files.get\n         * Fires before a file is output.\n         *\n         * Example usage:\n         *\n         *     Event::listen('backend.files.get', function ((\\System\\Models\\File) $file) {\n         *         // Block access to this file\n         *         return false;\n         *\n         *         // Or signal access denied\n         *         throw new \\ForbiddenException;\n         *     });\n         *\n         */\n        $response = Event::fire('backend.files.get', [$file], true);","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/controllers/Files.php#L172-L208","documentation":"Thrown by Files::findFileObject when the hash portion of the decoded code does not match md5(file_name!disk_name) of the located record. This guard (plus the class-swap logic above it) ensures the code was minted by the system for that exact file; a mismatch means the code was tampered with or refers to different file metadata.","triggerScenarios":"Thrown at modules/backend/controllers/Files.php:190 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use only file URLs/codes generated by the system for that file","Regenerate the link from the current file model (name/disk_name changed codes)","Do not alter the base64 code parameter in file URLs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","contentChangedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}