spacedriveapp/spacedrive · error
Failed to open window
Error message
Failed to open window
What it means
cx.open_window creates the OS window through GPUI and returns Err on failure; the expect panics. Window creation fails when there is no display connection, GPU surface creation fails, or the compositor rejects the window options.
Source
Thrown at apps/gpui-photo-grid/src/main.rs:68
show: true,
kind: WindowKind::Normal,
is_movable: true,
display_id: None,
..Default::default()
},
|_, cx| {
cx.new(|cx| {
PhotoGridView::new(
socket_addr,
http_url,
library_id,
initial_path,
cx,
)
})
},
)
.expect("Failed to open window");
});
}
View on GitHub (pinned to 6dfeccf211)
Solutions
- Ensure DISPLAY or WAYLAND_DISPLAY points at a reachable compositor session
- Run on the machine's local graphical session, not a headless SSH one
- On Linux, verify the GPU stack works for other accelerated apps (glxinfo -B, EGL demos)
- For CI/automation, run under Xvfb or mark the app as requiring a display
Example fix
// before: expect loses the failure reason
cx.open_window(opts, build).expect("Failed to open window");
// after: exit with the underlying error
match cx.open_window(opts, build) {
Ok(_) => {}
Err(e) => {
eprintln!("Failed to open window: {e}. Is a display/GPU available?");
std::process::exit(1);
}
} Defensive patterns
Strategy: validation
Validate before calling
// Before creating the window, confirm a display is reachable
#[cfg(target_os = "linux")]
if std::env::var_os("DISPLAY").is_none() && std::env::var_os("WAYLAND_DISPLAY").is_none() {
eprintln!("No display found; set DISPLAY or WAYLAND_DISPLAY");
std::process::exit(1);
} Try / catch
match cx.open_window(opts, build) {
Ok(handle) => handle,
Err(e) => {
eprintln!("Failed to open window: {e}");
std::process::exit(1);
}
} Prevention
- Run GPU apps in a local graphical session or via X11/Wayland forwarding
- Gate automated runs on Xvfb in CI
- Report the underlying GPUI error, never just 'failed to open window'
When it happens
Trigger: Running over SSH without X11/Wayland forwarding (DISPLAY/WAYLAND_DISPLAY unset); headless CI boxes; Wayland compositors that reject the window configuration; GPU drivers missing EGL/Vulkan support.
Common situations: cargo run on a remote dev box with no display; misconfigured WSLg or older X servers; driver-less VMs.
Related errors
- SD_LIBRARY_ID environment variable must be set
- Failed to create HTTP client
- failed to register Alt+Space global shortcut
- error while running tauri application
- System channel closed trying to resume not running task
AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16).
Data as JSON: /api/errors/6a54045a73c62e14.
Report an issue: GitHub.