{"record":{"id":"c43c6bbb3150d4a4","repo":"getgrav/grav","slug":"page-s-cannot-be-moved-to-itself","errorCode":null,"errorMessage":"Page /%s cannot be moved to itself","messagePattern":"Page /(.+?) cannot be moved to itself","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Common/Flex/Types/Pages/Storage/PageStorage.php","lineNumber":411,"sourceCode":"            if (is_string($oldKey)) {\n                // Initialize all old key-related variables.\n                $oldKeys = $this->extractKeysFromRow(['__META' => $row['__META']], false);\n                $oldFolder = $this->buildFolder($oldKeys);\n                $oldFilename = $this->buildFilename($oldKeys);\n\n                // Check if folder has changed.\n                if ($oldFolder !== $newFolder && file_exists($oldFolder)) {\n                    $isCopy = $row['__META']['copy'] ?? false;\n                    if ($isCopy) {\n                        if (str_starts_with($newFolder, $oldFolder . '/')) {\n                            throw new RuntimeException(sprintf('Page /%s cannot be copied to itself', $oldKey));\n                        }\n\n                        $this->copyRow($oldKey, $newKey);\n                        $debugger->addMessage(\"Page copied: {$oldFolder} => {$newFolder}\", 'debug');\n                    } else {\n                        if (str_starts_with($newFolder, $oldFolder . '/')) {\n                            throw new RuntimeException(sprintf('Page /%s cannot be moved to itself', $oldKey));\n                        }\n\n                        $this->renameRow($oldKey, $newKey);\n                        $debugger->addMessage(\"Page moved: {$oldFolder} => {$newFolder}\", 'debug');\n                    }\n                }\n\n                // Check if filename has changed.\n                if ($oldFilename !== $newFilename) {\n                    // Get instance of the old file (we have already copied/moved it).\n                    $oldFilepath = \"{$newFolder}/{$oldFilename}\";\n                    $file = $this->getFile($oldFilepath);\n\n                    // Rename the file if we aren't supposed to clone it.\n                    $isClone = $row['__META']['clone'] ?? false;\n                    if (!$isClone && $file->exists()) {\n                        /** @var UniformResourceLocator $locator */\n                        $locator = $grav['locator'];","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Flex/Types/Pages/Storage/PageStorage.php#L393-L429","documentation":"Error \"Page /%s cannot be moved to itself\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Flex/Types/Pages/Storage/PageStorage.php:411 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"}