LGUG2Z/komorebi · error
failed to find a window to move
Error message
failed to find a window to move
What it means
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.
Source
Thrown at komorebi/src/window_manager.rs:1714
target_workspace.layer = WorkspaceLayer::Tiling;
if let Some(direction) = move_direction {
target_monitor.add_container_with_direction(container, workspace_idx, direction)?;
} else {
target_monitor.add_container(container, workspace_idx)?;
}
if let Some(workspace) = target_monitor.focused_workspace()
&& !workspace.tile
{
for hwnd in container_hwnds {
Window::from(hwnd)
.move_to_area(¤t_area, &target_monitor.work_area_size)?;
}
}
} else {
bail!("failed to find a window to move");
}
if should_load_workspace {
target_monitor.load_focused_workspace(mouse_follows_focus)?;
}
target_monitor.update_focused_workspace(offset)?;
// this second one is for DPI changes when the target is another monitor
// if we don't do this the layout on the other monitor could look funny
// until it is interacted with again
target_monitor.update_focused_workspace(offset)?;
if follow {
self.focus_monitor(monitor_idx)?;
}
self.update_focused_workspace(self.mouse_follows_focus, true)?;
View on GitHub (pinned to e0709f02bf)
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
Example fix
// before komorebic cycle-monitor --move-enabled // error when workspace empty // after if [ -n "$(komorebic query focused-container-title 2>/dev/null)" ]; then komorebic cycle-monitor --move-enabled; fi
Defensive patterns
Strategy: validation
Validate before calling
// shell guard TITLE=$(komorebic query focused-container-title 2>/dev/null) [ -n "$TITLE" ] && komorebic cycle-monitor --move-enabled
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- cannot move native maximized window to another monitor or wo
- ignoring command while active window is in monocle mode or m
- there is only one window in this container
- there is no window in this container at index {idx}
- a container must have at least one window
AI-assisted analysis of LGUG2Z/komorebi@e0709f02bf (2026-09-06).
Data as JSON: /api/errors/48f21b1e1632b865.
Report an issue: GitHub.