{"record":{"id":"84579eb981ab9aa5","repo":"DioxusLabs/dioxus","slug":"no-global-window-exists","errorCode":null,"errorMessage":"no global `window` exists","messagePattern":"no global `window` exists","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/web/src/document.rs","lineNumber":172,"sourceCode":"                props.style_contents().ok().as_deref(),\n            );\n        });\n    }\n\n    /// Create a new link tag in the head\n    fn create_link(&self, props: LinkProps) {\n        queue_effect(move || {\n            _ = append_element_to_head(\"link\", &props.attributes(), None);\n        });\n    }\n}\n\nfn append_element_to_head(\n    local_name: &str,\n    attributes: &Vec<(&'static str, String)>,\n    text_content: Option<&str>,\n) -> Result<(), JsValue> {\n    let window = web_sys::window().expect(\"no global `window` exists\");\n    let document = window.document().expect(\"should have a document on window\");\n    let head = document.head().expect(\"document should have a head\");\n\n    let element = document.create_element(local_name)?;\n    for (name, value) in attributes {\n        element.set_attribute(name, value)?;\n    }\n    if text_content.is_some() {\n        element.set_text_content(text_content);\n    }\n    head.append_child(&element)?;\n\n    Ok(())\n}\n\n/// Required to avoid blocking the Rust WASM thread.\nconst PROMISE_WRAPPER: &str = r#\"\n    return (async function(){","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/web/src/document.rs#L154-L190","documentation":"The web renderer tried to access the global window while appending an element to the head, but none exists. The code is running outside a browser DOM environment (e.g. SSR or a worker without window).","triggerScenarios":"Thrown at packages/web/src/document.rs:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run this code in a browser/WASM context where a global `window` exists; it cannot run in SSR or non-web targets."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}