OpenCut-app / OpenCut-app/OpenCut

[BUG] Desktop app panics on window creation failure in headless environments

Open Beginner friendly
#842 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
89.8k
Forks
8.9k
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at apps/desktop/src/main.rs:50 and inspect the open_window call and its surrounding return type. Verify how errors are handled by nearby startup code, then replace the panic path with propagated or explicitly reported failure; done means window creation no longer panics in a headless environment and the error is user-visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.