astral-sh/ruff · error

uv synchronization worker terminated unexpectedly

Error message

uv synchronization worker terminated unexpectedly

What it means

This error signals that the background worker process/thread driving uv synchronization has terminated unexpectedly, so a caller waiting on it sees a broken channel. `worker_disconnected` returns a `std::io::Error` with kind `BrokenPipe` in `crates/ty_project/src/uv/service.rs`, used when the service's channel to (or from) the uv sync worker is closed before the operation completes.

Source

Thrown at crates/ty_project/src/uv/service.rs:356

struct UvJob {
    /// The request to return with the synchronization result.
    task: UvSyncTask,

    /// Checked before invoking uv; does not interrupt an already running process.
    cancellation: CancellationToken,

    /// The sender end of the channel communicating with the sync service.
    result_sender: Sender<UvMetadataResult>,

    /// The wake signal that notifies that there's a new result to process.
    wake_sender: Sender<()>,
    progress: Option<Box<dyn UvSyncProgress>>,
    span: tracing::Span,
}

fn worker_disconnected() -> std::io::Error {
    std::io::Error::new(
        std::io::ErrorKind::BrokenPipe,
        "uv synchronization worker terminated unexpectedly",
    )
}

View on GitHub (pinned to 26f38c119c)

Solutions

  1. Retry the synchronization request — the service typically respawns the worker on the next operation.
  2. Check logs/terminal output for a uv crash, panic, or OOM kill that terminated the worker.
  3. Ensure uv runs successfully standalone (`uv sync` manually) to rule out a project-level uv failure.
  4. If it reproduces, capture the worker's stderr and file an issue with the project setup.
Defensive patterns

Strategy: retry

Try / catch

// Rust caller: treat BrokenPipe from the uv service as a transient worker loss and retry once
match service.metadata(req).await {
  Err(e) if e.kind() == std::io::ErrorKind::BrokenPipe => {
    warn!("uv worker lost; retrying once");
    service.metadata(req).await?
  }
  other => other?,
}

Prevention

When it happens

Trigger: A metadata/sync request to the uv service finds the worker's sender/receiver dropped — the worker task exited or was cancelled mid-operation. Raised via `worker_disconnected()` at service.rs:356 on the UvMetadataResult path when receiving from the worker channel fails.

Common situations: uv crashes or is killed mid-sync (OOM, signal); the service is shut down while a request is in flight; IDE restarts/cancels the background worker during an active metadata request; a bug causing the worker task to panic and drop its channel end.

Related errors


AI-assisted analysis of astral-sh/ruff@26f38c119c (2026-09-05). Data as JSON: /api/errors/b1c15493e12d3c8e. Report an issue: GitHub.