{"record":{"id":"7baa8951d1a761d2","repo":"slint-ui/slint","slug":"winit-backend-specified-dom-element-is-not-a","errorCode":null,"errorMessage":"winit backend: Specified DOM element '{}' is not a HTML Canvas","messagePattern":"winit backend: Specified DOM element '(.+?)' is not a HTML Canvas","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/wasm-interpreter/src/lib.rs","lineNumber":361,"sourceCode":"                if let Some(canvas_id) = next_id.borrow_mut().take() {\n                    use i_slint_backend_winit::winit::platform::web::WindowAttributesExtWebSys;\n\n                    use wasm_bindgen::JsCast;\n\n                    let html_canvas = web_sys::window()\n                        .expect(\"wasm-interpreter: Could not retrieve DOM window\")\n                        .document()\n                        .expect(\"wasm-interpreter: Could not retrieve DOM document\")\n                        .get_element_by_id(&canvas_id)\n                        .unwrap_or_else(|| {\n                            panic!(\n                                \"wasm-interpreter: Could not retrieve existing HTML Canvas element '{}'\",\n                                canvas_id\n                            )\n                        })\n                        .dyn_into::<web_sys::HtmlCanvasElement>()\n                        .unwrap_or_else(|_| {\n                            panic!(\n                                \"winit backend: Specified DOM element '{}' is not a HTML Canvas\",\n                                canvas_id\n                            )\n                        });\n                    attrs = attrs\n                        .with_canvas(Some(html_canvas))\n                        // Don't activate the window by default, as that will cause the page to scroll,\n                        // ignoring any existing anchors.\n                        .with_active(false);\n                    attrs\n                } else {\n                    attrs\n                }\n            })\n        })\n        .build()\n        .unwrap();\n    i_slint_core::platform::set_platform(Box::new(backend))","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/api/wasm-interpreter/src/lib.rs#L343-L379","documentation":"Error \"winit backend: Specified DOM element '{}' is not a HTML Canvas\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at api/wasm-interpreter/src/lib.rs:361 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the id of a <canvas> element, not a generic <div> or other DOM element.","Replace the referenced element with a real HTMLCanvasElement."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016","analyzedAt":"2026-08-19T23:23:16.610Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}