getgrav/grav · error · RuntimeException

Page /%s cannot be moved to non-existing path %s

Error message

Page /%s cannot be moved to non-existing path %s

What it means

Error "Page /%s cannot be moved to non-existing path %s" thrown in getgrav/grav.

Source

Thrown at system/src/Grav/Common/Flex/Types/Pages/PageObject.php:224

        // Figure out storage path to the new route.
        $parentKey = $this->getProperty('parent_key');
        if ($parentKey !== '') {
            $parentRoute = $this->getProperty('route');

            // Root page cannot be moved.
            if ($this->root()) {
                throw new RuntimeException(sprintf('Root page cannot be moved to %s', $parentRoute));
            }

            // Make sure page isn't being moved under itself.
            $key = $this->getStorageKey();

            /** @var PageObject|null $parent */
            $parent = $parentKey !== false ? $this->getFlexDirectory()->getObject($parentKey, 'storage_key') : null;
            if (!$parent) {
                // Page cannot be moved to non-existing location.
                throw new RuntimeException(sprintf('Page /%s cannot be moved to non-existing path %s', $key, $parentRoute));
            }

            // TODO: make sure that the page doesn't exist yet if moved/copied.
        }

        if ($reorder === true && !$this->root()) {
            $reorder = $this->_reorder;
        }

        // Force automatic reorder if item is supposed to be added to the last.
        if (!is_array($reorder) && (int)$this->order() >= 999999) {
            $reorder = [];
        }

        // Reorder siblings.
        $siblings = is_array($reorder) ? ($this->reorderSiblings($reorder) ?? []) : [];

        $data = $this->prepareStorage();

View on GitHub (pinned to 6040efed04)

When it happens

Trigger: Thrown at system/src/Grav/Common/Flex/Types/Pages/PageObject.php:224 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/53f3dd88ef86dd62. Report an issue: GitHub.