{"record":{"id":"4c272a3707f7e041","repo":"zed-industries/zed","slug":"invalid-safe-area-probe-element-error","errorCode":null,"errorMessage":"Invalid safe-area probe element: {error:?}","messagePattern":"Invalid safe-area probe element: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/viewport.rs","lineNumber":115,"sourceCode":"}\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":97,"sourceCodeEnd":127,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_web/src/viewport.rs#L97-L127","documentation":"Fires in safe_area_probe after document.create_element(\"div\") succeeds but the returned Element fails dyn_into::<HtmlElement>. In wasm-bindgen this means the returned JS object was not an HTMLElement instance (or a JS exception occurred during the cast), so the fixed-position inset probe used to read env(safe-area-inset-<edge>) cannot be built or styled as an HTML element.","triggerScenarios":"Thrown at crates/gpui_web/src/viewport.rs:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the probe creation; a transient DOM/JSError during cast is unlikely but a retry costs nothing since probes are recreated per edge","Log the JsValue error and fall back to a zero default safe-area inset so viewport layout proceeds without probe measurements","Verify the wasm-bindgen/web-sys versions are compatible; a mismatched Element type mapping is the usual root cause"],"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"}