{"record":{"id":"b1c15493e12d3c8e","repo":"astral-sh/ruff","slug":"uv-synchronization-worker-terminated-unexpectedly","errorCode":null,"errorMessage":"uv synchronization worker terminated unexpectedly","messagePattern":"uv synchronization worker terminated unexpectedly","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ty_project/src/uv/service.rs","lineNumber":356,"sourceCode":"\nstruct UvJob {\n    /// The request to return with the synchronization result.\n    task: UvSyncTask,\n\n    /// Checked before invoking uv; does not interrupt an already running process.\n    cancellation: CancellationToken,\n\n    /// The sender end of the channel communicating with the sync service.\n    result_sender: Sender<UvMetadataResult>,\n\n    /// The wake signal that notifies that there's a new result to process.\n    wake_sender: Sender<()>,\n    progress: Option<Box<dyn UvSyncProgress>>,\n    span: tracing::Span,\n}\n\nfn worker_disconnected() -> std::io::Error {\n    std::io::Error::new(\n        std::io::ErrorKind::BrokenPipe,\n        \"uv synchronization worker terminated unexpectedly\",\n    )\n}\n","sourceCodeStart":338,"sourceCodeEnd":361,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ty_project/src/uv/service.rs#L338-L361","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the synchronization request — the service typically respawns the worker on the next operation.","Check logs/terminal output for a uv crash, panic, or OOM kill that terminated the worker.","Ensure uv runs successfully standalone (`uv sync` manually) to rule out a project-level uv failure.","If it reproduces, capture the worker's stderr and file an issue with the project setup."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust caller: treat BrokenPipe from the uv service as a transient worker loss and retry once\nmatch service.metadata(req).await {\n  Err(e) if e.kind() == std::io::ErrorKind::BrokenPipe => {\n    warn!(\"uv worker lost; retrying once\");\n    service.metadata(req).await?\n  }\n  other => other?,\n}","preventionTips":["Keep uv worker stderr/log capture enabled to diagnose why the worker died.","Avoid shutting down or restarting the service while sync requests are in flight.","Verify `uv sync` succeeds standalone so the worker doesn't crash on project issues.","Monitor memory: worker OOM kills manifest as this broken-pipe error."],"tags":["uv","worker","ipc","broken-pipe"],"backgroundTag":"worker-crashed","analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}