{"record":{"id":"af8c2a7f40bf0020","repo":"zed-industries/zed","slug":"created-element-is-not-a-canvas-error","errorCode":null,"errorMessage":"Created element is not a canvas: {error:?}","messagePattern":"Created element is not a canvas: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/window.rs","lineNumber":89,"sourceCode":"    /// 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\nimpl WebWindow {\n    pub(crate) fn prepare_canvas(","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_web/src/window.rs#L71-L107","documentation":"Guard in WebWindow::prepare_canvas: the element returned by createElement('canvas') failed dyn_into::<HtmlCanvasElement> — the created node is somehow not a canvas element, indicating DOM API tampering or an unusual embedding environment.","triggerScenarios":"Thrown at crates/gpui_web/src/window.rs:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log the element's tagName and constructor to identify what the environment actually returned","Guard against scripts/libraries that monkey-patch document.createElement","Treat as an unsupported environment and abort canvas preparation with the cast error"],"exampleFix":null,"handlingStrategy":"type-guard","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"}