zed-industries/zed · error

Subprocess reported error during start: {message}

Error message

Subprocess reported error during start: {message}

What it means

Thrown by launch_etw_recording() in Zed's etw_tracing crate (Windows-only ETW profiling). Zed re-launches its own exe elevated via ShellExecuteW("runas") with --record-etw-trace; the elevated child connects back over an AF_UNIX socket and must send StatusMessage::Started as its first JSON line. Instead it sent StatusMessage::Error{message}, meaning the child failed inside record_etw_trace before the WPR recording started (COM init, building the WPR profile collection, creating IControlManager, or control_manager.Start). The {message} field is the child's full anyhow error chain and contains the real cause.

Source

Thrown at crates/etw_tracing/etw_tracing.rs:629

        bail!("ShellExecuteW failed to launch elevated process (code: {result_code})");
    }

    let (stream, _) = listener.accept().context("Accept subprocess connection")?;

    let mut session = EtwSession {
        output_path: output_path.to_path_buf(),
        stream: BufReader::new(stream),
        listener,
        socket_path: sock_path,
    };

    let status: StatusMessage =
        recv_json(&mut session.stream).context("Wait for Started status")?;

    match status {
        StatusMessage::Started => {}
        StatusMessage::Error { message } => {
            bail!("Subprocess reported error during start: {message}");
        }
        other => {
            bail!("Unexpected status from subprocess: {other:?}");
        }
    }

    Ok(session)
}

#[derive(Debug, serde::Serialize, serde::Deserialize)]
#[serde(tag = "type")]
pub enum StatusMessage {
    Started,
    Stopped,
    TimedOut,
    Cancelled,
    Error { message: String },
}

View on GitHub (pinned to f4178619ac)

Solutions

  1. Read the full error chain in {message} - it names the exact failing step (e.g. 'Start WPR recording') and the underlying HRESULT
  2. Cancel leftover WPR/ETW sessions: run 'wpr -cancel' (or reboot) to clear kernel buffer sessions leaked by a previous recording
  3. Retry the recording; transient WPR start failures are common after abrupt termination of an earlier session
  4. Verify the target process pid is alive if you triggered heap-specific profiling (heap_pid)
  5. Report a Zed bug with the inner {message} if Start WPR recording fails consistently on a healthy machine
Defensive patterns

Strategy: try-catch

Try / catch

// Treat ETW launch as fallible and always surface the inner message
match launch_etw_recording(heap_pid, output_path) {
    Ok(session) => { /* proceed */ }
    Err(err) => {
        // err's Display already embeds the subprocess's {message}
        log::warn!("ETW recording failed to start: {err:#}");
        show_user_error(err);
    }
}

Prevention

When it happens

Trigger: Calling launch_etw_recording(heap_pid, output_path) (Zed's ETW/latency trace recording entry point) where the elevated subprocess fails at CoInitializeEx, build_profile_collection (e.g. invalid/unspawnable heap_pid profile), create_wpr, or 'Start WPR recording'. The child serializes its failure as {"type":"Error","message":"..."} and the parent bails with this message.

Common situations: WPR (Windows Performance Recorder) API refusing to start a session, leftover ETW sessions with the same name, COM initialization failure in the elevated context, heap_pid pointing at a dead process when the profile is built, or the output path being unwritable. The actionable detail is always inside {message}, not this outer wrapper.

Related errors


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