{"record":{"id":"73d5725f411c26a2","repo":"Textualize/textual","slug":"can-t-make-self-active-as-it-is-not-in-the-curre","errorCode":null,"errorMessage":"Can't make {self} active as it is not in the current stack.","messagePattern":"Can't make (.+?) active as it is not in the current stack\\.","errorType":"exception","errorClass":"ScreenError","httpStatus":null,"severity":"error","filePath":"src/textual/screen.py","lineNumber":2096,"sourceCode":"\n        await_pop.set_pre_await_callback(pre_await)\n\n        return await_pop\n\n    def pop_until_active(self) -> None:\n        \"\"\"Pop any screens on top of this one, until this screen is active.\n\n        Raises:\n            ScreenError: If this screen is not in the current mode.\n\n        \"\"\"\n        from textual.app import ScreenError\n\n        try:\n            self.app._pop_to_screen(self)\n        except ScreenError:\n            # More specific error message\n            raise ScreenError(\n                f\"Can't make {self} active as it is not in the current stack.\"\n            ) from None\n\n    async def action_dismiss(self, result: ScreenResultType | None = None) -> None:\n        \"\"\"A wrapper around [`dismiss`][textual.screen.Screen.dismiss] that can be called as an action.\n\n        Args:\n            result: The optional result to be passed to the result callback.\n        \"\"\"\n        await self._flush_next_callbacks()\n        self.dismiss(result)\n\n    def can_view_entire(self, widget: Widget) -> bool:\n        \"\"\"Check if a given widget is fully within the current screen.\n\n        Note: This doesn't necessarily equate to a widget being visible.\n        There are other reasons why a widget may not be visible.\n","sourceCodeStart":2078,"sourceCodeEnd":2114,"githubUrl":"https://github.com/Textualize/textual/blob/06dbeef4bb70fb718236aa418ed658ef4667a126/src/textual/screen.py#L2078-L2114","documentation":"pop_until_active tries to pop the screen stack down to this screen, but the underlying App._pop_to_screen failed, meaning this screen instance is not in the active stack.","triggerScenarios":"Calling screen.pop_until_active() (usually via the make_base_active action) on a screen that was already dismissed, never pushed, or was removed from the stack.","commonSituations":"Holding a stale reference to a dismissed modal and re-triggering navigation to it; calling the action after the screen stack changed asynchronously.","solutions":["Re-create and push the screen instead of reusing a dismissed instance","Check 'self in self.app.screen_stack' before calling","Use app.switch_screen() for replacing the base screen"],"exampleFix":"# before\nself.old_screen.pop_until_active()  # stale reference\n# after\nself.app.switch_screen(MainScreen())","handlingStrategy":"validation","validationCode":"if self in self.app.screen_stack:\n    self.pop_until_active()","typeGuard":null,"tryCatchPattern":"from textual.app import ScreenError\ntry:\n    screen.pop_until_active()\nexcept ScreenError:\n    app.switch_screen(screen.__class__())","preventionTips":["Do not retain references to dismissed screens","Re-push fresh screen instances for navigation"],"tags":["screen","navigation","stack","textual"],"backgroundTag":"stale-screen-reference","analyzedSha":"06dbeef4bb70fb718236aa418ed658ef4667a126","analyzedAt":"2026-08-27T02:36:57.214Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}