{"record":{"id":"895ef5cecc80859f","repo":"slint-ui/slint","slug":"cannot-show-component-err","errorCode":null,"errorMessage":"Cannot show component: {err}","messagePattern":"Cannot show component: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/viewer/remote.rs","lineNumber":411,"sourceCode":"        }\n        PreviewCompilation::ComponentNotFound => {\n            swap_to_placeholder(\n                placeholder,\n                user_instance,\n                chrome,\n                \"Component not found\",\n                RemoteViewerState::PreviewError,\n            )?;\n            return Ok(());\n        }\n        PreviewCompilation::Unavailable => return Ok(()),\n    };\n\n    let new_instance = component\n        .create_with_existing_window(placeholder.window())\n        .map_err(|err| anyhow::anyhow!(\"Cannot create component instance: {err}\"))?;\n\n    new_instance.show().map_err(|err| anyhow::anyhow!(\"Cannot show component: {err}\"))?;\n    *user_instance = Some(new_instance);\n    // The placeholder is hidden now, but keep its state property truthful.\n    placeholder.set_state(RemoteViewerState::Previewing);\n    Ok(())\n}\n\n/// Everything on the placeholder screen that doesn't depend on what the\n/// connection is doing.\n///\n/// [`swap_to_placeholder`] builds a whole new window each time, so anything\n/// missing from [`Chrome::apply`] silently disappears the first time the\n/// preview is swapped out.\nstruct Chrome {\n    /// Newline-separated `ip:port` list the editor can be pointed at.\n    address: String,\n    /// Friendly device name. Bonjour can rename us on iOS resume, so this\n    /// isn't fixed for the life of the process.\n    name: String,","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/tools/viewer/remote.rs#L393-L429","documentation":"ComponentInstance::show failed after build_and_show successfully created the preview component instance on the existing window. Showing the instance makes it the visible content of the remote-viewer window; a failure here means the runtime could not present the component (window/backend rejection), and it is treated as an unrecoverable anyhow error.","triggerScenarios":"new_instance.show() returns Err after create_with_existing_window succeeded in build_and_show — the window backend refuses to show the freshly swapped-in component (window already closing, platform event-loop failure, renderer unavailable).","commonSituations":"User disconnects or the device window is destroyed during the swap; embedded platform backend cannot show a second component on the same window; slint runtime/platform initialization problems on the target device.","solutions":["Retry via show_current so the placeholder is reinstalled and the component is re-created and shown from scratch.","Verify the window and platform event loop are still alive at swap time; guard the swap against concurrent teardown.","Update editor and viewer to matching slint versions to rule out runtime incompatibilities.","Read the inner error from new_instance.show() to identify the platform/backend cause and fix the window setup."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match new_instance.show() {\n    Ok(()) => { *user_instance = Some(new_instance); },\n    Err(err) => {\n        // window/backend refused the show; fall back to the placeholder\n        tracing::error!(\"Cannot show component: {err}\");\n        let _ = swap_to_placeholder(placeholder, user_instance, chrome, \"Preview failed\", RemoteViewerState::PreviewError);\n    }\n}","preventionTips":["Confirm the slint platform/event loop is running before swapping components.","Check window liveness before calling show on a swapped-in instance.","Reuse one window per viewer process instead of creating/destroying windows rapidly.","Keep editor and viewer on matching slint versions."],"tags":["slint","interpreter","window","remote-viewer"],"backgroundTag":"component-instantiation-failed","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}