{"record":{"id":"b4d378cd1b24a3c1","repo":"zed-industries/zed","slug":"all-windows-should-be-off-the-stack-when-flushing","errorCode":null,"errorMessage":"All windows should be off the stack when flushing effects","messagePattern":"All windows should be off the stack when flushing effects","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui/src/app.rs","lineNumber":1857,"sourceCode":"                } else {\n                    true\n                }\n            });\n    }\n\n    fn apply_refresh_effect(&mut self) {\n        for window in self.windows.values_mut() {\n            if let Some(window) = window.as_deref_mut() {\n                window.refreshing = true;\n                window.invalidator.set_dirty(true);\n            }\n        }\n    }\n\n    fn apply_notify_global_observers_effect(&mut self, type_id: TypeId) {\n        self.pending_global_notifications.remove(&type_id);\n        self.global_observers\n            .clone()\n            .retain(&type_id, |observer| observer(self));\n    }\n\n    fn apply_defer_effect(&mut self, callback: Box<dyn FnOnce(&mut Self) + 'static>) {\n        callback(self);\n    }\n\n    fn apply_entity_created_effect(\n        &mut self,\n        entity: AnyEntity,\n        tid: TypeId,\n        window: Option<WindowId>,\n    ) {\n        // Seed the entity's current window from its creation context so\n        // `with_window` resolves correctly before the entity has ever been\n        // rendered.\n        if let Some(id) = window {\n            self.current_window_by_entity.insert(entity.entity_id(), id);","sourceCodeStart":1839,"sourceCodeEnd":1875,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui/src/app.rs#L1839-L1875","documentation":"An executor invariant during effect flushing: when GPUI flushes deferred effects (new-entity observers, etc.) it asserts the window stack is empty — every window pushed for effect execution has been popped. The expect fires if a window was pushed but not popped (an effect handler leaked its window context or errored mid-way), meaning effect flush ran while a window context was still active — an internal framework bug, not application logic.","triggerScenarios":"Thrown at crates/gpui/src/app.rs:1820 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a guard object (Drop pops the window) so a panic or early return in an effect handler cannot leave a window on the stack","Recover by popping the stale window and logging the imbalance instead of aborting","Add tests that run effect flush after handlers that early-return, catching stack imbalance in CI"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}