{"record":{"id":"6b5ed189300f4445","repo":"zed-industries/zed","slug":"failed-to-create-browser-graphics-surface-error","errorCode":null,"errorMessage":"Failed to create browser graphics surface: {error}","messagePattern":"Failed to create browser graphics surface: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_wgpu/src/wgpu_context.rs","lineNumber":178,"sourceCode":"            WebBackendPreference::WebGpu => wgpu::Backends::BROWSER_WEBGPU,\n            WebBackendPreference::WebGl => wgpu::Backends::GL,\n        };\n        let descriptor = wgpu::InstanceDescriptor {\n            backends,\n            flags: wgpu::InstanceFlags::default(),\n            backend_options: wgpu::BackendOptions::default(),\n            memory_budget_thresholds: wgpu::MemoryBudgetThresholds::default(),\n            display: Some(Box::new(WebDisplaySource)),\n        };\n        let instance = if preference == WebBackendPreference::Auto {\n            wgpu::util::new_instance_with_webgpu_detection(descriptor).await\n        } else {\n            wgpu::Instance::new(descriptor)\n        };\n        let surface = instance\n            .create_surface(wgpu::SurfaceTarget::Canvas(canvas.clone()))\n            .map_err(|error| {\n                anyhow::anyhow!(\"Failed to create browser graphics surface: {error}\")\n            })?;\n\n        let adapter = instance\n            .request_adapter(&wgpu::RequestAdapterOptions {\n                power_preference: wgpu::PowerPreference::HighPerformance,\n                compatible_surface: Some(&surface),\n                force_fallback_adapter: false,\n            })\n            .await\n            .map_err(|error| {\n                anyhow::anyhow!(\n                    \"Failed to request a {preference:?} adapter compatible with the canvas: {error}\"\n                )\n            })?;\n        let adapter_info = adapter.get_info();\n        let backend = match adapter_info.backend {\n            wgpu::Backend::BrowserWebGpu => WgpuBackend::BrowserWebGpu,\n            wgpu::Backend::Gl => WgpuBackend::Gl,","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_wgpu/src/wgpu_context.rs#L160-L196","documentation":"Raised in `WgpuContext::new_web_with_backend` when `instance.create_surface(SurfaceTarget::Canvas)` fails, meaning wgpu could not wrap the browser canvas as a rendering surface (backend mismatch, e.g. requesting WebGPU on a browser without it, or the canvas is not usable). {error} carries the wgpu CreateSurfaceError.","triggerScenarios":"Thrown at crates/gpui_wgpu/src/wgpu_context.rs:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fall back to the WebGL (Backends::GL) path when WebGPU surface creation fails.","Confirm the browser supports WebGPU (Chrome/Edge 113+, or Firefox with WebGPU enabled).","Ensure the canvas element is attached to the DOM and not already in use by another context.","Inspect the CreateSurfaceError message to distinguish unsupported backend from invalid canvas."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}