slint-ui/slint · error

uninitialized platform

Error message

uninitialized platform

What it means

Error "uninitialized platform" thrown in slint-ui/slint.

Source

Thrown at internal/backends/testing/mcp_server.rs:855

async fn run_server(state: Rc<IntrospectionState>, port: u16) {
    let addr = format!("127.0.0.1:{port}");
    let listener = match async_net::TcpListener::bind(&addr).await {
        Ok(l) => l,
        Err(e) => {
            eprintln!("MCP server: failed to bind to {addr}: {e}");
            return;
        }
    };
    eprintln!("Slint MCP server listening on http://{addr}/mcp");

    loop {
        match listener.accept().await {
            Ok((stream, _peer)) => {
                stream.set_nodelay(true).ok();
                let state = state.clone();
                let _ = i_slint_core::with_global_context(
                    || panic!("uninitialized platform"),
                    |context| {
                        let _ = context.spawn_local(async move {
                            handle_connection(&state, stream).await;
                        });
                    },
                );
            }
            Err(e) => {
                eprintln!("MCP server: accept error: {e}");
            }
        }
    }
}

// ============================================================================
// Initialization
// ============================================================================

View on GitHub (pinned to 3fd8f2ec03)

Solutions

  1. Initialize the Slint platform/backend before starting the MCP server.
  2. Ensure the MCP server is started after the application creates its window.

When it happens

Trigger: Thrown at internal/backends/testing/mcp_server.rs:855 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19). Data as JSON: /api/errors/987010f8071f4ace. Report an issue: GitHub.