[BUG] Desktop app panics on window creation failure in headless environments
Author: kapil971390Created Jul 14, 2026Updated Sep 8, 2026
Problem
The desktop app will crash with a panic when window creation fails:
File: apps/desktop/src/main.rs:50
cx.open_window(
WindowOptions { ... },
|_, cx| { ... }
)
.expect("failed to open the main window");
Scenarios Where It Breaks
- Running in CI/headless environment (no display server)
- SSH session without X forwarding
- Display server unavailable (Wayland/X11 connection fails)
- GPU initialization errors
- System resource exhaustion
Root Cause
Using .expect() on a Result causes panic on Err instead of graceful error handling.
Expected Behavior
Application should:
- Return proper error instead of panicking
- Provide fallback mode for headless execution
- Display user-friendly error message
Recommended Fix
Replace .expect() with proper error handling:
cx.open_window(...)?
Or with explicit error handling:
cx.open_window(...).map_err(|e| {
eprintln!("Failed to open window: {}", e);
e
})?
Detection Method: Static code analysis Severity: Critical (blocks headless/CI usage)
Source: OpenCut-app/OpenCut