zed-industries/zed · error
Failed to create input element: {e:?}
Error message
Failed to create input element: {e:?} What it means
In gpui_web window construction: creating the hidden DOM input element used for text input failed (document.createElement errored). This is a browser DOM failure during window initialization — the web text-input bridge cannot be set up.
Source
Thrown at crates/gpui_web/src/window.rs:150
anyhow::anyhow!("Failed to set canvas {property} style: {error:?}")
})?;
}
let body = document
.body()
.ok_or_else(|| anyhow::anyhow!("No `body` found on document"))?;
body.append_child(&canvas)
.map_err(|error| anyhow::anyhow!("Failed to append canvas to body: {error:?}"))?;
Ok(canvas)
}
#[allow(clippy::too_many_arguments)]
pub(crate) fn new(
_handle: AnyWindowHandle,
_params: WindowParams,
context: &WgpuContext,
canvas: web_sys::HtmlCanvasElement,
surface: wgpu::Surface<'static>,
browser_window: web_sys::Window,
lifecycle: Rc<Cell<WebWindowLifecycle>>,
active_window: Rc<RefCell<Option<AnyWindowHandle>>>,
) -> anyhow::Result<Self> {
let document = browser_window
.document()
.ok_or_else(|| anyhow::anyhow!("No `document` found on window"))?;
let body = document
.body()
.ok_or_else(|| anyhow::anyhow!("No `body` found on document"))?;
let dpr = browser_window.device_pixel_ratio() as f32;
let max_texture_dimension = context.device.limits().max_texture_dimension_2d;
let has_device_pixel_support = check_device_pixel_support();
let renderer_config = WgpuSurfaceConfig {
size: Size {
width: DevicePixels(0),
height: DevicePixels(0),
},View on GitHub (pinned to 9d272b0363)
Solutions
- Verify the DOM environment allows dynamic element creation (CSP, sandbox flags)
- Create the input element once and reuse it across window rebuilds
- Surface the JS error detail when text-input setup fails so the page environment issue is diagnosable
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/gpui_web/src/window.rs:143 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20).
Data as JSON: /api/errors/7f4919e846476725.
Report an issue: GitHub.