{"record":{"id":"55d593a2f2527aef","repo":"zed-industries/zed","slug":"failed-to-create-safe-area-probe-error","errorCode":null,"errorMessage":"Failed to create safe-area probe: {error:?}","messagePattern":"Failed to create safe-area probe: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/viewport.rs","lineNumber":113,"sourceCode":"        Ok(changed)\n    }\n}\n\nimpl Drop for WebViewport {\n    fn drop(&mut self) {\n        for probe in &self.safe_area_probes {\n            probe.remove();\n        }\n    }\n}\n\nfn safe_area_probe(\n    document: &web_sys::Document,\n    edge: &str,\n) -> anyhow::Result<web_sys::HtmlElement> {\n    let probe = document\n        .create_element(\"div\")\n        .map_err(|error| anyhow::anyhow!(\"Failed to create safe-area probe: {error:?}\"))?\n        .dyn_into::<web_sys::HtmlElement>()\n        .map_err(|error| anyhow::anyhow!(\"Invalid safe-area probe element: {error:?}\"))?;\n    probe\n        .set_attribute(\n            \"style\",\n            &format!(\n                \"position:fixed;left:0;top:0;width:0;padding:0;border:0;visibility:hidden;\\\n                 pointer-events:none;height:env(safe-area-inset-{edge},0px)\"\n            ),\n        )\n        .map_err(|error| anyhow::anyhow!(\"Failed to style safe-area probe: {error:?}\"))?;\n    Ok(probe)\n}\n","sourceCodeStart":95,"sourceCodeEnd":127,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_web/src/viewport.rs#L95-L127","documentation":"A DOM sentinel error in the safe_area_probe helper: document.create_element(\"div\") returned an Err (wrapped with the offending JsValue) while creating one of the four edge probes used to observe safe-area insets. createElement essentially never fails for 'div' in a healthy document, so this indicates a broken document context (e.g. an XML/SVG document or a destroyed window) rather than a problem with the probe configuration itself.","triggerScenarios":"Thrown at crates/gpui_web/src/viewport.rs:113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure viewport construction runs on a fully loaded HTML document (wait for DOMContentLoaded)","Inspect the {error:?} JsValue (usually NotSupportedError) to confirm the document supports HTML element creation","Defer or disable safe-area probing in hosting contexts that provide non-HTML documents"],"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-14T05:17:10.506Z"}