{"record":{"id":"f317fb3a35e28903","repo":"zed-industries/zed","slug":"missing-root","errorCode":null,"errorMessage":"Missing root","messagePattern":"Missing root","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/viewport.rs","lineNumber":54,"sourceCode":"        // Separate boxes detect redistribution between edges even when the\n        // total inset, and therefore a single combined probe's size, is unchanged.\n        for probe in &self.safe_area_probes {\n            observer.observe(probe);\n        }\n    }\n\n    pub(crate) fn update(\n        &mut self,\n        window: &web_sys::Window,\n        canvas: &web_sys::HtmlCanvasElement,\n    ) -> anyhow::Result<bool> {\n        let canvas_bounds = canvas.get_bounding_client_rect();\n        let document = window\n            .document()\n            .ok_or_else(|| anyhow::anyhow!(\"Missing document\"))?;\n        let root = document\n            .document_element()\n            .ok_or_else(|| anyhow::anyhow!(\"Missing root\"))?;\n        let layout_width = root.client_width() as f64;\n        let layout_height = root.client_height() as f64;\n        let (left, top, width, height) = match window.visual_viewport() {\n            Some(viewport) => (\n                viewport.offset_left(),\n                viewport.offset_top(),\n                viewport.width(),\n                viewport.height(),\n            ),\n            None => (0., 0., layout_width, layout_height),\n        };\n        // VisualViewport offsets and getBoundingClientRect share layout CSS\n        // coordinates. Multiplying by the pinch scale here would incorrectly\n        // expand the visible rectangle back to its unzoomed size.\n        let x = (left - canvas_bounds.left()).clamp(0., canvas_bounds.width());\n        let y = (top - canvas_bounds.top()).clamp(0., canvas_bounds.height());\n        let right = (left + width - canvas_bounds.left()).clamp(x, canvas_bounds.width());\n        let bottom = (top + height - canvas_bounds.top()).clamp(y, canvas_bounds.height());","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_web/src/viewport.rs#L36-L72","documentation":"A sentinel guard in WebViewport::update: after obtaining the document, document.documentElement() returned None, so the viewport cannot read the root <html> element it needs for layout and inset measurements. Like the missing-document case this realistically occurs during teardown or in malformed/non-HTML documents; the frame's bounds update is aborted.","triggerScenarios":"Thrown at crates/gpui_web/src/viewport.rs:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Skip the update for this frame and reuse cached bounds when the root element is momentarily unavailable","Avoid calling update during unload/teardown of the page","Verify the served document is well-formed HTML with an <html> root element"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-09-12T19:35:53.743Z","contentChangedAt":"2026-09-12T19:35:53.743Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}