{"record":{"id":"c1e9698cc4804cc2","repo":"zed-industries/zed","slug":"no-body-found-on-document","errorCode":null,"errorMessage":"No `body` found on document","messagePattern":"No `body` found on document","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/window.rs","lineNumber":109,"sourceCode":"}\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(\n        browser_window: &web_sys::Window,\n    ) -> anyhow::Result<web_sys::HtmlCanvasElement> {\n        let document = browser_window\n            .document()\n            .ok_or_else(|| anyhow::anyhow!(\"No `document` found on window\"))?;\n        let canvas: web_sys::HtmlCanvasElement = document\n            .create_element(\"canvas\")\n            .map_err(|error| anyhow::anyhow!(\"Failed to create canvas element: {error:?}\"))?\n            .dyn_into()\n            .map_err(|error| anyhow::anyhow!(\"Created element is not a canvas: {error:?}\"))?;\n        canvas.set_tab_index(-1);\n\n        let style = canvas.style();\n        for (property, value) in [\n            (\"width\", \"100%\"),\n            (\"height\", \"100%\"),\n            (\"display\", \"block\"),\n            (\"outline\", \"none\"),\n            (\"touch-action\", \"none\"),\n            (\"-webkit-touch-callout\", \"none\"),","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_web/src/window.rs#L91-L127","documentation":"Guard in WebWindow::prepare_canvas: document.body() returned None — the document has no <body> element yet (script ran in <head> before body parsing) or the document type never has a body (e.g. XML documents).","triggerScenarios":"Thrown at crates/gpui_web/src/window.rs:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run initialization after DOMContentLoaded so document.body exists","Use document.documentElement as an append target when body is absent","Defer canvas insertion with a MutationObserver if the host page builds body dynamically"],"exampleFix":null,"handlingStrategy":"validation","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-14T05:17:10.506Z"}