{"record":{"id":"fc52556fc1cdba8a","repo":"zed-industries/zed","slug":"failed-to-create-canvas-element-error","errorCode":null,"errorMessage":"Failed to create canvas element: {error:?}","messagePattern":"Failed to create canvas element: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/window.rs","lineNumber":87,"sourceCode":"    pub(crate) is_composing: Cell<bool>,\n    /// Set while `show_virtual_keyboard` blur/focus-cycles the hidden input.\n    /// The cycle is a keyboard-visibility hint, not a real activity change;\n    /// letting the focus/blur listeners report it would re-enter GPUI\n    /// synchronously from inside an input dispatch, and a `RefCell`\n    /// double-borrow panic on wasm never unwinds, wedging the app.\n    pub(crate) suppress_focus_status_events: Cell<bool>,\n    /// The visual viewport height when the current pointer gesture began.\n    /// A mid-gesture change means the software keyboard opened or closed and\n    /// reflowed the layout, so the release position no longer refers to what\n    /// the user aimed at.\n    pub(crate) gesture_start_visual_viewport_height: Cell<f64>,\n    /// A touch that may still resolve into a tap: its pointer id and starting\n    /// position, cleared once it travels beyond touch slop. Virtual keyboard\n    /// and IME focus may only change when a touch release completes a tap;\n    /// pans must leave them untouched, or scrolling over editable content\n    /// flickers the keyboard and drags the caret around.\n    pub(crate) touch_tap_candidate: Cell<Option<(i32, Point<Pixels>)>>,\n    mql_handle: RefCell<Option<MqlHandle>>,\n    pending_physical_size: Cell<Option<(u32, u32)>>,\n    raf_id: Cell<Option<i32>>,\n    raf_function: RefCell<Option<js_sys::Function>>,\n}\n\npub struct WebWindow {\n    inner: Rc<WebWindowInner>,\n    display: Rc<dyn PlatformDisplay>,\n    lifecycle: Rc<Cell<WebWindowLifecycle>>,\n    active_window: Rc<RefCell<Option<AnyWindowHandle>>>,\n    _raf_closure: Closure<dyn FnMut()>,\n    _resize_observer: Option<web_sys::ResizeObserver>,\n    _resize_observer_closure: Closure<dyn FnMut(js_sys::Array)>,\n    _safe_area_observer: Option<web_sys::ResizeObserver>,\n    _safe_area_observer_closure: Closure<dyn FnMut(js_sys::Array)>,\n    _event_listeners: WebEventListeners,\n}\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_web/src/window.rs#L69-L105","documentation":"Guard in WebWindow::prepare_canvas: document.createElement('canvas') threw — {error:?} is the JS exception. Usually a Document with an inert/locked DOM, custom-element interference, or a stripped-down embedding context that rejects element creation.","triggerScenarios":"Thrown at crates/gpui_web/src/window.rs:85 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the page is a normal HTML document (not XML/inert) before creating the canvas","Check for CSP or sanitizer environments that block dynamic DOM insertion","Propagate the JS error detail so the embedding context problem is diagnosable"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}