octobercms/october · error · SystemException

Unable to remove navigation items before they are loaded.

Error message

Unable to remove navigation items before they are loaded.

What it means

Error "Unable to remove navigation items before they are loaded." thrown in octobercms/october.

Source

Thrown at modules/backend/classes/NavigationManager.php:266

    /**
     * getMainMenuItem returns a main menu item
     */
    public function getMainMenuItem(string $owner, string $code): ?MainMenuItem
    {
        $itemKey = $this->makeItemKey($owner, $code);

        return $this->items[$itemKey] ?? null;
    }

    /**
     * removeMainMenuItem removes a single main menu item
     * @param $owner
     * @param $code
     */
    public function removeMainMenuItem($owner, $code)
    {
        if ($this->items === null) {
            throw new SystemException('Unable to remove navigation items before they are loaded.');
        }

        $itemKey = $this->makeItemKey($owner, $code);

        unset($this->items[$itemKey]);
    }

    /**
     * addSideMenuItems dynamically adds an array of side menu items
     * @param string $owner
     * @param string $code
     * @param array  $definitions
     */
    public function addSideMenuItems($owner, $code, array $definitions)
    {
        foreach ($definitions as $sideCode => $definition) {
            if (is_array($definition)) {
                $this->addSideMenuItem($owner, $code, $sideCode, $definition);

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/backend/classes/NavigationManager.php:266 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/9fb9795b4e4cb809. Report an issue: GitHub.