{"record":{"id":"48f21b1e1632b865","repo":"LGUG2Z/komorebi","slug":"failed-to-find-a-window-to-move","errorCode":null,"errorMessage":"failed to find a window to move","messagePattern":"failed to find a window to move","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"komorebi/src/window_manager.rs","lineNumber":1714,"sourceCode":"\n            target_workspace.layer = WorkspaceLayer::Tiling;\n\n            if let Some(direction) = move_direction {\n                target_monitor.add_container_with_direction(container, workspace_idx, direction)?;\n            } else {\n                target_monitor.add_container(container, workspace_idx)?;\n            }\n\n            if let Some(workspace) = target_monitor.focused_workspace()\n                && !workspace.tile\n            {\n                for hwnd in container_hwnds {\n                    Window::from(hwnd)\n                        .move_to_area(&current_area, &target_monitor.work_area_size)?;\n                }\n            }\n        } else {\n            bail!(\"failed to find a window to move\");\n        }\n\n        if should_load_workspace {\n            target_monitor.load_focused_workspace(mouse_follows_focus)?;\n        }\n        target_monitor.update_focused_workspace(offset)?;\n\n        // this second one is for DPI changes when the target is another monitor\n        // if we don't do this the layout on the other monitor could look funny\n        // until it is interacted with again\n        target_monitor.update_focused_workspace(offset)?;\n\n        if follow {\n            self.focus_monitor(monitor_idx)?;\n        }\n\n        self.update_focused_workspace(self.mouse_follows_focus, true)?;\n","sourceCodeStart":1696,"sourceCodeEnd":1732,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi/src/window_manager.rs#L1696-L1732","documentation":"move_container_to_monitor could not identify a container/window to transfer: the code path that collects the container's HWNDs found none (the else branch after computing current_area/target areas). Without a window to relocate the monitor move is a no-op, so it fails loudly.","triggerScenarios":"Invoking move_container_to_monitor when the focused workspace/container has no movable container — e.g. the focused workspace is empty or only contains a native-maximized/unmanaged window that was filtered out, so no container HWND list exists.","commonSituations":"Pressing move-to-monitor hotkeys with no tiling window focused; empty workspace on the focused monitor; scripting komorebic commands against a workspace that just lost its only window.","solutions":["Ensure a tiled window is focused before moving it to another monitor","Check the focused workspace actually has containers (komorebic state) before sending the command","Guard scripted calls by inspecting komorebi state first and skipping the move when empty","Report if it occurs with a visible tiled window focused — may indicate an index desync bug"],"exampleFix":"// before\nkomorebic cycle-monitor --move-enabled // error when workspace empty\n// after\nif [ -n \"$(komorebic query focused-container-title 2>/dev/null)\" ]; then komorebic cycle-monitor --move-enabled; fi","handlingStrategy":"validation","validationCode":"// shell guard\nTITLE=$(komorebic query focused-container-title 2>/dev/null)\n[ -n \"$TITLE\" ] && komorebic cycle-monitor --move-enabled","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure a tiled window is focused before move-to-monitor commands","Check komorebic state for non-empty workspace in scripts","Report persistent occurrences with a visible window — possible index desync"],"tags":["windows","window-manager","empty-workspace"],"backgroundTag":"empty-result-set","analyzedSha":"e0709f02bfae4e503bf4640f58ee75ecbbfdbb97","analyzedAt":"2026-09-06T07:08:05.107Z","contentChangedAt":"2026-09-06T07:08:05.107Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}