zed-industries/zed · error
Idle sleep prevention request was abandoned
Error message
Idle sleep prevention request was abandoned
What it means
When requesting an idle-sleep prevention guard on Linux, the platform sends the request to the display-server thread and waits on a oneshot channel. If the sender side is dropped before answering — the request was abandoned, e.g. the backend implementing the guard was torn down — the receiver gets a RecvError and this error is returned.
Source
Thrown at crates/gpui_linux/src/linux/platform.rs:1369
request
.close()
.await
.context("Failed to release idle sleep prevention")
.log_err();
})
.detach();
})
}
#[cfg(any(feature = "wayland", feature = "x11"))]
async fn await_idle_sleep_prevention(
guard_rx: oneshot::Receiver<Result<ActivityGuard>>,
executor: &BackgroundExecutor,
) -> Result<ActivityGuard> {
match futures::future::select(guard_rx, executor.timer(Duration::from_secs(10))).await {
futures::future::Either::Left((Ok(result), _)) => result,
futures::future::Either::Left((Err(_), _)) => {
Err(anyhow!("Idle sleep prevention request was abandoned"))
}
futures::future::Either::Right(_) => Err(anyhow!(
"Idle sleep prevention acquisition timed out after 10 seconds"
)),
}
}
#[cfg(test)]
mod tests {
use super::*;
use gpui::{Point, px};
#[cfg(any(feature = "wayland", feature = "x11"))]
#[test]
fn rejects_null_xkb_context() {
let context = unsafe {
// libxkbcommon permits unref on null, matching the value returned by Context::new on failure.
xkb::Context::from_raw_ptr(std::ptr::null_mut())View on GitHub (pinned to 9d272b0363)
Solutions
- Retry the idle-sleep prevention request once the platform/connection is confirmed alive.
- Ensure the platform instance (window/display connection) outlives the prevent_idle_sleep call.
- Check logs for Wayland/X11 connection errors that would kill the backend task handling the request.
- If triggered at app shutdown, guard the call site so idle prevention is not requested during teardown.
Defensive patterns
Strategy: retry
Try / catch
match platform.prevent_idle_sleep(reason).await {
Err(e) if e.to_string().contains("abandoned") => {
log::warn!("idle-sleep request abandoned, retrying once");
platform.prevent_idle_sleep(reason).await?;
}
other => other?,
} Prevention
- Do not tear down windows or the platform while an idle-inhibition request is in flight.
- Keep idle-prevention requests on a live platform/connection instance.
- Watch for Wayland/X11 disconnects in logs; re-establish the session before requesting guards.
- Avoid issuing new guard requests during app shutdown.
When it happens
Trigger: prevent_idle_sleep's inner request future completes with the guard_rx oneshot channel closed without a value: the Wayland/X11 helper task or the object responsible for producing the ActivityGuard was dropped/cancelled before replying.
Common situations: Shutting down or closing a window while an idle-inhibition request is in flight; the display backend thread exiting (display server disconnect) mid-request; a race where the app quits between issuing the request and the reply.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Idle sleep prevention for {reason:?} requires a Linux window
- Idle sleep prevention acquisition timed out after 10 seconds
- blocking sender returned without value
- No GPU adapters found
- wl_seat below required version: {} < {}
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-09-12).
Data as JSON: /api/errors/7b7cc84d689eb931.
Report an issue: GitHub.