{"record":{"id":"3b942ca873e8f086","repo":"octobercms/october","slug":"unable-to-remove-a-widget-before-widgets-are-loade","errorCode":null,"errorMessage":"Unable to remove a widget before widgets are loaded.","messagePattern":"Unable to remove a widget before widgets are loaded\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/backend/classes/widgetmanager/HasReportWidgets.php","lineNumber":191,"sourceCode":"        }\n\n        $_name = Str::normalizeClassName($name);\n        if (isset($this->reportWidgets[$_name])) {\n            return $_name;\n        }\n\n        return $name;\n    }\n\n    /**\n     * removeReportWidget removes a registered ReportWidget.\n     * @param string $className Widget class name.\n     * @return void\n     */\n    public function removeReportWidget($className)\n    {\n        if (!$this->reportWidgets) {\n            throw new SystemException('Unable to remove a widget before widgets are loaded.');\n        }\n\n        unset($this->reportWidgets[$className]);\n    }\n}\n","sourceCodeStart":173,"sourceCodeEnd":197,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/classes/widgetmanager/HasReportWidgets.php#L173-L197","documentation":"Thrown by WidgetManager's removeReportWidget when the internal reportWidgets registry is falsy (not yet populated). It is an initialization-order guard: report widgets must be registered/loaded before any can be removed, so this fires when removal is attempted too early in the boot cycle.","triggerScenarios":"Thrown at modules/backend/classes/widgetmanager/HasReportWidgets.php:191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Defer the removal until after widget registration (e.g. inside an event listener that fires post-boot)","Register widgets via registerReportWidgets in the plugin instead of mutating the manager early","Ensure the WidgetManager instance has been initialized/loaded before calling removeReportWidget"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","contentChangedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}