{"record":{"id":"e5c4388da6c880f7","repo":"getgrav/grav","slug":"failed-cannot-set-page-parent-to-self","errorCode":null,"errorMessage":"Failed: Cannot set page parent to self","messagePattern":"Failed: Cannot set page parent to self","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Common/Page/Page.php","lineNumber":1414,"sourceCode":"    /**\n     * Prepare move page to new location. Moves also everything that's under the current page.\n     *\n     * You need to call $this->save() in order to perform the move.\n     *\n     * @param PageInterface $parent New parent page.\n     * @return $this\n     */\n    public function move(PageInterface $parent)\n    {\n        if (!$this->_original) {\n            $clone = clone $this;\n            $this->_original = $clone;\n        }\n\n        $this->_action = 'move';\n\n        if ($this->route() === $parent->route()) {\n            throw new RuntimeException('Failed: Cannot set page parent to self');\n        }\n        if (Utils::startsWith($parent->rawRoute(), $this->rawRoute())) {\n            throw new RuntimeException('Failed: Cannot set page parent to a child of current page');\n        }\n\n        $this->parent($parent);\n        $this->id(time() . md5((string) $this->filePath()));\n\n        if ($parent->path()) {\n            $this->path($parent->path() . '/' . $this->folder());\n        }\n\n        if ($parent->route()) {\n            $this->route($parent->route() . '/' . $this->slug());\n        } else {\n            $this->route(Grav::instance()['pages']->root()->route() . '/' . $this->slug());\n        }\n","sourceCodeStart":1396,"sourceCodeEnd":1432,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Page/Page.php#L1396-L1432","documentation":"Error \"Failed: Cannot set page parent to self\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Page/Page.php:1414 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"}