{"record":{"id":"63eebe0fea4d647c","repo":"getgrav/grav","slug":"plugin-admin-file-could-not-be-deleted","errorCode":null,"errorMessage":"PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED","messagePattern":"PLUGIN_ADMIN\\.FILE_COULD_NOT_BE_DELETED","errorType":"exception","errorClass":"RuntimeException","httpStatus":500,"severity":"error","filePath":"system/src/Grav/Common/Media/Traits/MediaUploadTrait.php","lineNumber":579,"sourceCode":"    {\n        $filesystem = Filesystem::getInstance(false);\n\n        /** @var UniformResourceLocator $locator */\n        $locator = $this->getGrav()['locator'];\n\n        // If path doesn't exist, there's nothing to do.\n        $pathname = $filesystem->pathname($filename);\n        if (!$this->fileExists($pathname, $path)) {\n            return;\n        }\n\n        $folder = $locator->isStream($path) ? (string)$locator->findResource($path, true, true) : $path;\n\n        // Remove requested media file.\n        if ($this->fileExists($filename, $path)) {\n            $result = unlink(\"{$folder}/{$filename}\");\n            if (!$result) {\n                throw new RuntimeException($this->translate('PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED') . ': ' . $filename, 500);\n            }\n        }\n\n        // Remove associated metadata.\n        $this->doRemoveMetadata($filename, $path);\n\n        // Remove associated 2x, 3x and their .meta.yaml files.\n        $targetPath = rtrim(sprintf('%s/%s', $folder, $pathname), '/');\n        $dir = scandir($targetPath, SCANDIR_SORT_NONE);\n        if (false === $dir) {\n            throw new RuntimeException($this->translate('PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED') . ': ' . $filename, 500);\n        }\n\n        /** @var UniformResourceLocator $locator */\n        $locator = $this->getGrav()['locator'];\n\n        $basename = $filesystem->basename($filename);\n        $fileParts = (array)$filesystem->pathinfo($filename);","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php#L561-L597","documentation":"Error \"PLUGIN_ADMIN.FILE_COULD_NOT_BE_DELETED\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Media/Traits/MediaUploadTrait.php:579 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":"6040efed04efa69b8209448ed81308e7c24147c2","analyzedAt":"2026-08-17T05:07:31.593Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}