{"record":{"id":"506cee1e7358b9bd","repo":"zed-industries/zed","slug":"failed-to-style-safe-area-probe-error","errorCode":null,"errorMessage":"Failed to style safe-area probe: {error:?}","messagePattern":"Failed to style safe-area probe: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/viewport.rs","lineNumber":124,"sourceCode":"\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":106,"sourceCodeEnd":127,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_web/src/viewport.rs#L106-L127","documentation":"Fires when HtmlElement::set_attribute(\"style\", ...) rejects for the safe-area probe element (created successfully just before). set_attribute returns a Promise in the DOM and web_sys surfaces rejection as a JsValue; a malformed style string or a detached/invalid element are typical triggers. The probe measures env(safe-area-inset-<edge>) so losing it means inset defaults to 0.","triggerScenarios":"Thrown at crates/gpui_web/src/viewport.rs:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the generated style string for the failing edge; an unexpected edge value could produce an invalid CSS env() expression","Catch the failure at the caller (new) and proceed with default (0px) safe-area insets while logging the JsValue error","If it persists, set style properties via the CSSStyleDeclaration (element.style()) instead of set_attribute to isolate the invalid attribute"],"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"}