zed-industries/zed · error

Idle sleep prevention for {reason:?} is not supported in the

Error message

Idle sleep prevention for {reason:?} is not supported in the browser

What it means

An explicit capability guard in the browser implementation of prevent_idle_sleep: desktop platforms use the reason string to acquire a power-save blocker (e.g. during long operations), but no equivalent Wake Lock API call is wired into this web platform stub, so the request is rejected with this message rather than silently pretending to work. It fires whenever application code asks the web platform to keep the display/system awake.

Source

Thrown at crates/gpui_web/src/platform.rs:527

    fn on_will_open_app_menu(&self, callback: Box<dyn FnMut()>) {
        self.callbacks.borrow_mut().will_open_app_menu = Some(callback);
    }

    fn on_validate_app_menu_command(&self, callback: Box<dyn FnMut(&dyn Action) -> bool>) {
        self.callbacks.borrow_mut().validate_app_menu_command = Some(callback);
    }

    fn thermal_state(&self) -> ThermalState {
        ThermalState::Nominal
    }

    fn on_thermal_state_change(&self, callback: Box<dyn FnMut()>) {
        self.callbacks.borrow_mut().thermal_state_change = Some(callback);
    }

    fn prevent_idle_sleep(&self, reason: &str) -> Task<Result<ActivityGuard>> {
        Task::ready(Err(anyhow::anyhow!(
            "Idle sleep prevention for {reason:?} is not supported in the browser"
        )))
    }

    fn compositor_name(&self) -> &'static str {
        "Web"
    }

    fn app_path(&self) -> Result<PathBuf> {
        Err(anyhow::anyhow!("app_path is not available on the web"))
    }

    fn path_for_auxiliary_executable(&self, _name: &str) -> Result<PathBuf> {
        Err(anyhow::anyhow!(
            "path_for_auxiliary_executable is not available on the web"
        ))
    }

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Ignore this error on the web: idle-sleep prevention is intentionally unsupported there
  2. Gate prevent_idle_sleep usage on the platform (cfg or a runtime capability check) before calling it
  3. Contribute a navigator.wakeLock.request('screen') implementation behind a browser feature check to actually support it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/gpui_web/src/platform.rs:527 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-09-12). Data as JSON: /api/errors/6814c7007ad693c7. Report an issue: GitHub.