{"record":{"id":"95f9024e0ed0545b","repo":"getgrav/grav","slug":"meta-could-not-be-renamed-s-s-s","errorCode":null,"errorMessage":"Meta could not be renamed: %s -> %s (%s)","messagePattern":"Meta could not be renamed: (.+?) -> (.+?) \\((.+?)\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":500,"severity":"error","filePath":"system/src/Grav/Common/Media/Traits/MediaUploadTrait.php","lineNumber":549,"sourceCode":"        }\n\n        if (is_file($toPath)) {\n            // TODO: translate error message\n            throw new RuntimeException(sprintf('File could not be renamed: %s already exists (%s)', $to, $mediaPath), 500);\n        }\n\n        $result = rename($fromPath, $toPath);\n        if (!$result) {\n            // TODO: translate error message\n            throw new RuntimeException(sprintf('File could not be renamed: %s -> %s (%s)', $from, $to, $mediaPath), 500);\n        }\n\n        // TODO: Add missing logic to handle retina files.\n        if (is_file($fromPath . '.meta.yaml')) {\n            $result = rename($fromPath . '.meta.yaml', $toPath . '.meta.yaml');\n            if (!$result) {\n                // TODO: translate error message\n                throw new RuntimeException(sprintf('Meta could not be renamed: %s -> %s (%s)', $from, $to, $mediaPath), 500);\n            }\n        }\n    }\n\n    /**\n     * Internal logic to remove file.\n     *\n     * @param string $filename\n     * @param string $path\n     */\n    protected function doRemove(string $filename, string $path): void\n    {\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.","sourceCodeStart":531,"sourceCodeEnd":567,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php#L531-L567","documentation":"Error \"Meta could not be renamed: %s -> %s (%s)\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Media/Traits/MediaUploadTrait.php:549 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"}