{"record":{"id":"9fb9795b4e4cb809","repo":"octobercms/october","slug":"unable-to-remove-navigation-items-before-they-are","errorCode":null,"errorMessage":"Unable to remove navigation items before they are loaded.","messagePattern":"Unable to remove navigation items before they are loaded\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/backend/classes/NavigationManager.php","lineNumber":266,"sourceCode":"    /**\n     * getMainMenuItem returns a main menu item\n     */\n    public function getMainMenuItem(string $owner, string $code): ?MainMenuItem\n    {\n        $itemKey = $this->makeItemKey($owner, $code);\n\n        return $this->items[$itemKey] ?? null;\n    }\n\n    /**\n     * removeMainMenuItem removes a single main menu item\n     * @param $owner\n     * @param $code\n     */\n    public function removeMainMenuItem($owner, $code)\n    {\n        if ($this->items === null) {\n            throw new SystemException('Unable to remove navigation items before they are loaded.');\n        }\n\n        $itemKey = $this->makeItemKey($owner, $code);\n\n        unset($this->items[$itemKey]);\n    }\n\n    /**\n     * addSideMenuItems dynamically adds an array of side menu items\n     * @param string $owner\n     * @param string $code\n     * @param array  $definitions\n     */\n    public function addSideMenuItems($owner, $code, array $definitions)\n    {\n        foreach ($definitions as $sideCode => $definition) {\n            if (is_array($definition)) {\n                $this->addSideMenuItem($owner, $code, $sideCode, $definition);","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/classes/NavigationManager.php#L248-L284","documentation":"Error \"Unable to remove navigation items before they are loaded.\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/backend/classes/NavigationManager.php:266 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":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}