zed-industries/zed · error · anyhow::Error

WSL kernel process exited prematurely with status: {:?}\nstd

Error message

WSL kernel process exited prematurely with status: {:?}\nstderr: {}\nstdout: {}

What it means

Raised in the WSL kernel constructor when the spawned `wsl` kernel process terminates before the connection is established. The exit status plus captured stderr/stdout are included so the user can see why the kernel (e.g. missing Python or bad argv inside the distro) died immediately.

Source

Thrown at crates/repl/src/kernels/wsl_kernel.rs:314

                    let mut stderr_content = String::new();
                    if let Some(mut stderr) = process.stderr.take() {
                        use futures::AsyncReadExt;
                        let mut buf = Vec::new();
                        if stderr.read_to_end(&mut buf).await.is_ok() {
                            stderr_content = String::from_utf8_lossy(&buf).to_string();
                        }
                    }

                    let mut stdout_content = String::new();
                    if let Some(mut stdout) = process.stdout.take() {
                        use futures::AsyncReadExt;
                        let mut buf = Vec::new();
                        if stdout.read_to_end(&mut buf).await.is_ok() {
                            stdout_content = String::from_utf8_lossy(&buf).to_string();
                        }
                    }

                    anyhow::bail!(
                        "WSL kernel process exited prematurely with status: {:?}\nstderr: {}\nstdout: {}",
                        status,
                        stderr_content,
                        stdout_content
                    );
                }
                Ok(None) => {}
                Err(_) => {}
            }

            let output_socket = runtimelib::create_client_iopub_connection(
                &client_connection_info,
                "",
                &session_id,
            )
            .await
            .context("Failed to create iopub connection. Is `ipykernel` installed in the WSL environment? Try running `pip install ipykernel` inside your WSL distribution.")?;

View on GitHub (pinned to f4178619ac)

Solutions

  1. Read the captured stderr/stdout in the error to find the kernel's startup failure
  2. Verify python/ipykernel are installed in the WSL distribution
  3. Check that jupyter runtime connection files are writable
  4. Reinstall the kernel and retry
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/repl/src/kernels/wsl_kernel.rs:314 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/762308e6ac71806e. Report an issue: GitHub.