{"record":{"id":"9518db245a7bfd11","repo":"zed-industries/zed","slug":"failed-to-attach-safe-area-probe-error","errorCode":null,"errorMessage":"Failed to attach safe-area probe: {error:?}","messagePattern":"Failed to attach safe-area probe: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/viewport.rs","lineNumber":30,"sourceCode":"    pub(crate) visible_bounds: Bounds<Pixels>,\n    pub(crate) insets: WindowInsets,\n}\n\nimpl WebViewport {\n    pub(crate) fn new(document: &web_sys::Document) -> anyhow::Result<Self> {\n        let [top, right, bottom, left] =\n            [\"top\", \"right\", \"bottom\", \"left\"].map(|edge| safe_area_probe(document, edge));\n        let viewport = Self {\n            safe_area_probes: [top?, right?, bottom?, left?],\n            visible_bounds: Bounds::default(),\n            insets: WindowInsets::default(),\n        };\n        let body = document\n            .body()\n            .ok_or_else(|| anyhow::anyhow!(\"Missing document body\"))?;\n        for probe in &viewport.safe_area_probes {\n            body.append_child(probe)\n                .map_err(|error| anyhow::anyhow!(\"Failed to attach safe-area probe: {error:?}\"))?;\n        }\n        Ok(viewport)\n    }\n\n    pub(crate) fn observe_safe_area(&self, observer: &web_sys::ResizeObserver) {\n        // 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();","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_web/src/viewport.rs#L12-L48","documentation":"The `?` on append_child for the safe-area probe divs failed: append_child returns a Result in web-sys, and this map_err wraps the JsValue error. The DOM refused to attach one of the probe elements (top/right/bottom/left) used to measure env(safe-area-inset-*). This is a generic DOM-mutation failure sentinel; the input at fault is the probe element/document pair being appended.","triggerScenarios":"Thrown at crates/gpui_web/src/viewport.rs:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry initialization after the DOM is ready; appending before the document is fully parsed can transiently fail","Check for DOM-mutation blockers (strict CSP, frameworks clearing body) that reject programmatic child insertion","Log the {error:?} JsValue details to identify which edge probe failed and why"],"exampleFix":null,"handlingStrategy":"retry","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-14T05:17:10.506Z"}