zed-industries/zed · critical
Too many consecutive GPU errors. Last error: {error}
Error message
Too many consecutive GPU errors. Last error: {error} What it means
The wgpu backend of GPUI checks after each frame whether the GPU reported an error. A few consecutive failures trigger recovery (after 5 failures intermediate textures and the atlas are invalidated and a redraw is forced), but once more than 10 consecutive failing frames accumulate the renderer gives up and panics with the last error. It is a circuit breaker against a persistently broken device or render loop, not against a single transient glitch.
Source
Thrown at crates/gpui_wgpu/src/wgpu_renderer.rs:1295
// Bail out early if the surface has been unconfigured (e.g. during
// Android background/rotation transitions). Attempting to acquire
// a texture from an unconfigured surface can block indefinitely on
// some drivers (Adreno).
if !self.surface_configured {
return false;
}
let last_error = self.last_error.lock().unwrap().take();
if let Some(error) = last_error {
self.failed_frame_count += 1;
log::error!(
"GPU error during frame (failure {} of 10): {error}",
self.failed_frame_count
);
// TBD. Does retrying more actually help?
if self.failed_frame_count > 10 {
panic!("Too many consecutive GPU errors. Last error: {error}");
} else if self.failed_frame_count > 5 {
if let Some(res) = self.resources.as_mut() {
res.invalidate_intermediate_textures();
}
self.atlas.clear();
self.needs_redraw = true;
self.failed_frame_count = 0;
return false;
}
} else {
self.failed_frame_count = 0;
}
self.atlas.before_frame();
let frame = match self.resources().surface.get_current_texture() {
wgpu::CurrentSurfaceTexture::Success(frame) => frame,
wgpu::CurrentSurfaceTexture::Suboptimal(frame) => {View on GitHub (pinned to f4178619ac)
Solutions
- Update the GPU driver and, on Linux, try a different backend via the WGPU_BACKEND environment variable (e.g. WGPU_BACKEND=gl or vulkan) to bypass a broken driver path
- Free GPU memory: close other GPU-heavy apps and check your own renderer for texture/atlas leaks
- Run with RUST_LOG=wgpu=debug to capture the actual wgpu error string that follows 'Last error:' and fix that specific error
- If it is hardware/driver specific, report upstream with the error text, adapter info, and driver version
Example fix
# before: default backend picks a broken driver path, panics after ~10 frames WGPU_BACKEND=auto ./your_app # after: force a stable backend and capture the underlying wgpu error WGPU_BACKEND=gl RUST_LOG=wgpu=debug ./your_app
Defensive patterns
Strategy: fallback
Validate before calling
// if you own device setup, reject known-bad adapters before creating the renderer
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor::default());
if let Some(adapter) = instance.request_adapter(&wgpu::RequestAdapterOptions::default()).await {
let info = adapter.get_info();
if info.backend == wgpu::Backend::Gl && requires_modern_gpu {
// surface a clear error instead of letting the frame circuit breaker panic later
return Err(anyhow!("only OpenGL adapter available; GPU support insufficient"));
}
} Try / catch
// supervisor: let the renderer circuit-break without taking the process down silently
let outcome = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| run_ui_loop()));
if outcome.is_err() {
log::error!("renderer panicked after repeated GPU errors; restarting");
recreate_renderer_or_exit_gracefully();
} Prevention
- Keep GPU drivers current, especially on Linux where backend quality varies
- Watch VRAM usage in your renderer; release textures and atlas entries you no longer use
- Run with RUST_LOG=wgpu=debug in QA so the underlying 'Last error' string is always captured
- Expose a backend override (e.g. WGPU_BACKEND) so users on broken drivers can switch paths
When it happens
Trigger: The wgpu device keeps erroring every frame: driver crash or reset, out-of-video-memory, a broken backend for the installed driver (e.g. misbehaving Vulkan stack), or genuinely invalid pipeline/render state in a custom renderer built on gpui_wgpu. Recovery at failure 5 did not help and errors continued past 10.
Common situations: Outdated or buggy GPU drivers, especially Linux Vulkan stacks; VMs and remote-desktop sessions with weak GPU support; apps leaking textures until VRAM runs out; browser/WebGPU differences when running the wasm build.
Related errors
- surface configuration failed: {e}
- Adapter {:?} (backend={:?}, device={:#06x}) is not compatibl
- No GPU adapters found
- No GPU adapter found that can configure the display surface
- no compatible surface formats
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/5a69b17e73997e90.
Report an issue: GitHub.