{"record":{"id":"7447adab15bd55b7","repo":"getgrav/grav","slug":"cannot-reorder-a-page-which-has-no-parent","errorCode":null,"errorMessage":"Cannot reorder a page which has no parent","messagePattern":"Cannot reorder a page which has no parent","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Common/Flex/Types/Pages/PageObject.php","lineNumber":419,"sourceCode":"    }\n\n    /**\n     * @param array $ordering\n     * @return PageCollection|null\n     * @phpstan-return ObjectCollection<string,PageObject>|null\n     */\n    protected function reorderSiblings(array $ordering)\n    {\n        $storageKey = $this->getMasterKey();\n        $isMoved = $this->isMoved();\n        $order = !$isMoved ? $this->order() : false;\n        if ($order !== false) {\n            $order = (int)$order;\n        }\n\n        $parent = $this->parent();\n        if (!$parent) {\n            throw new RuntimeException('Cannot reorder a page which has no parent');\n        }\n\n        /** @var PageCollection $siblings */\n        $siblings = $parent->children();\n        $siblings = $siblings->getCollection()->withOrdered();\n\n        // Handle special case where ordering isn't given.\n        if ($ordering === []) {\n            if ($order >= 999999) {\n                // Set ordering to point to be the last item, ignoring the object itself.\n                $order = 0;\n                foreach ($siblings as $sibling) {\n                    if ($sibling->getKey() !== $this->getKey()) {\n                        $order = max($order, (int)$sibling->order());\n                    }\n                }\n                $this->order($order + 1);\n            }","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Flex/Types/Pages/PageObject.php#L401-L437","documentation":"Error \"Cannot reorder a page which has no parent\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Flex/Types/Pages/PageObject.php:419 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"}