{"record":{"id":"48c5f5cd5eabe08f","repo":"octobercms/october","slug":"unable-to-remove-permissions-before-they-are-loade","errorCode":null,"errorMessage":"Unable to remove permissions before they are loaded.","messagePattern":"Unable to remove permissions before they are loaded\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/backend/classes/RoleManager.php","lineNumber":155,"sourceCode":"                $permission = new RolePermission(array_merge($definition, [\n                    'code' => $code,\n                    'owner' => $owner\n                ]));\n\n                $this->permissions[] = $permission;\n            }\n        }\n    }\n\n    /**\n     * removePermission removes a single back-end permission. Where owner specifies the\n     * permissions' owner plugin or module in the format Author.Plugin. Where code is\n     * the permission to remove.\n     */\n    public function removePermission(string $owner, string $code)\n    {\n        if ($this->permissions === null) {\n            throw new SystemException('Unable to remove permissions before they are loaded.');\n        }\n\n        $ownerPermissions = array_filter($this->permissions, function ($permission) use ($owner) {\n            return $permission->owner === $owner;\n        });\n\n        foreach ($ownerPermissions as $key => $permission) {\n            if ($permission->code === $code) {\n                unset($this->permissions[$key]);\n            }\n        }\n    }\n\n    /**\n     * listPermissions returns a list of the registered permissions items.\n     */\n    public function listPermissions(): array\n    {","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/classes/RoleManager.php#L137-L173","documentation":"Error \"Unable to remove permissions before they are loaded.\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/backend/classes/RoleManager.php:155 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"}