{"record":{"id":"e1a4bb0961d3a4ee","repo":"octobercms/october","slug":"invalid-code","errorCode":null,"errorMessage":"Invalid code","messagePattern":"Invalid code","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/backend/controllers/Files.php","lineNumber":166,"sourceCode":"\n        $hash = md5($file->file_name . '!' . $file->disk_name);\n        return base64_encode($file->id . '!' . $hash);\n    }\n\n    /**\n     * findFileObject locates a file model based on the unique code.\n     * @param $code string\n     * @return System\\Models\\File\n     */\n    protected function findFileObject($code)\n    {\n        if (!$code) {\n            throw new ApplicationException('Missing code');\n        }\n\n        $parts = explode('!', base64_decode($code));\n        if (count($parts) < 2) {\n            throw new ApplicationException('Invalid code');\n        }\n\n        [$id, $hash] = $parts;\n\n        if (!$file = FileModel::find((int) $id)) {\n            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);","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/controllers/Files.php#L148-L184","documentation":"Error \"Invalid code\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/backend/controllers/Files.php:166 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}