getgrav/grav · error · RuntimeException
Failed: Cannot set page parent to a child of current page
Error message
Failed: Cannot set page parent to a child of current page
What it means
Error "Failed: Cannot set page parent to a child of current page" thrown in getgrav/grav.
Source
Thrown at system/src/Grav/Common/Page/Page.php:1417
* You need to call $this->save() in order to perform the move.
*
* @param PageInterface $parent New parent page.
* @return $this
*/
public function move(PageInterface $parent)
{
if (!$this->_original) {
$clone = clone $this;
$this->_original = $clone;
}
$this->_action = 'move';
if ($this->route() === $parent->route()) {
throw new RuntimeException('Failed: Cannot set page parent to self');
}
if (Utils::startsWith($parent->rawRoute(), $this->rawRoute())) {
throw new RuntimeException('Failed: Cannot set page parent to a child of current page');
}
$this->parent($parent);
$this->id(time() . md5((string) $this->filePath()));
if ($parent->path()) {
$this->path($parent->path() . '/' . $this->folder());
}
if ($parent->route()) {
$this->route($parent->route() . '/' . $this->slug());
} else {
$this->route(Grav::instance()['pages']->root()->route() . '/' . $this->slug());
}
$this->raw_route = null;
return $this;View on GitHub (pinned to 6040efed04)
When it happens
Trigger: Thrown at system/src/Grav/Common/Page/Page.php:1417 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of getgrav/grav@6040efed04 (2026-08-17).
Data as JSON: /api/errors/e4960905560468e2.
Report an issue: GitHub.