octobercms/october · error · SystemException

Unable to remove permissions before they are loaded.

Error message

Unable to remove permissions before they are loaded.

What it means

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

Source

Thrown at modules/backend/classes/RoleManager.php:155

                $permission = new RolePermission(array_merge($definition, [
                    'code' => $code,
                    'owner' => $owner
                ]));

                $this->permissions[] = $permission;
            }
        }
    }

    /**
     * removePermission removes a single back-end permission. Where owner specifies the
     * permissions' owner plugin or module in the format Author.Plugin. Where code is
     * the permission to remove.
     */
    public function removePermission(string $owner, string $code)
    {
        if ($this->permissions === null) {
            throw new SystemException('Unable to remove permissions before they are loaded.');
        }

        $ownerPermissions = array_filter($this->permissions, function ($permission) use ($owner) {
            return $permission->owner === $owner;
        });

        foreach ($ownerPermissions as $key => $permission) {
            if ($permission->code === $code) {
                unset($this->permissions[$key]);
            }
        }
    }

    /**
     * listPermissions returns a list of the registered permissions items.
     */
    public function listPermissions(): array
    {

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/backend/classes/RoleManager.php:155 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/48c5f5cd5eabe08f. Report an issue: GitHub.