astral-sh/ruff · error

`uv sync` failed to run with exit code `{code}`, stderr: {st

Error message

`uv sync` failed to run with exit code `{code}`, stderr: {stderr}

What it means

While materializing tasks from a truth fixture, the eval harness runs `uv sync` in the (temp copy of the) fixture project to build its `.venv` before computing completions. This error means uv executed but exited non-zero; the exit code (or `UNKNOWN` on signal death) and uv's raw stderr are included in the message.

Source

Thrown at crates/ty_completion_eval/src/main.rs:471

    ///
    /// This includes running `uv sync` to set up a full virtual
    /// environment.
    fn to_tasks(&self, parent_dst_dir: &SystemPath) -> anyhow::Result<Vec<Task>> {
        let dir = parent_dst_dir.join(&self.name);
        let cursors = copy_project(&self.dir, &dir)?;
        let uv_sync_output = std::process::Command::new("uv")
            .arg("sync")
            .current_dir(dir.as_std_path())
            .output()
            .with_context(|| format!("failed to run `uv sync` in `{dir}`"))?;
        if !uv_sync_output.status.success() {
            let code = uv_sync_output
                .status
                .code()
                .map(|code| code.to_string())
                .unwrap_or_else(|| "UNKNOWN".to_string());
            let stderr = bstr::BStr::new(&uv_sync_output.stderr);
            anyhow::bail!("`uv sync` failed to run with exit code `{code}`, stderr: {stderr}")
        }
        cursors
            .into_iter()
            .map(|cursor| Task::new(&dir, &self.truth, cursor))
            .collect()
    }
}

/// A single cursor directive within a single Python project.
///
/// Each cursor directive looks like:
/// `<CURSOR [expected-module.]expected-symbol>`.
///
/// That is, each cursor directive corresponds to a single completion
/// request, and each request is a single evaluation task.
#[derive(Clone, Debug)]
struct Cursor {
    /// The path to the file containing this directive.

View on GitHub (pinned to 672bb4edf0)

Solutions

  1. Reproduce manually: run `uv sync` inside the original fixture directory under `crates/ty_completion_eval/truth/` and read the full error
  2. Install the pinned interpreter (`uv python install <version>`) or update uv, then retry
  3. Relock the fixture (`uv lock`) after dependency edits
  4. Check UV_HTTP_TIMEOUT / HTTPS_PROXY settings for flaky downloads

Example fix

# before: eval run aborts with `uv sync` failed ...
cargo run -p ty_completion_eval -- all
# after: fix the failing fixture's environment first
cd crates/ty_completion_eval/truth/<fixture> && uv sync && cd -
cargo run -p ty_completion_eval -- all
Defensive patterns

Strategy: retry

Validate before calling

cd crates/ty_completion_eval/truth/$FIXTURE && uv sync --dry-run >/dev/null 2>&1 \
  || echo "warning: fixture env not clean; eval may fail" >&2

Try / catch

# shell: bounded retry around the eval run for transient uv failures
for i in 1 2; do
  cargo run -p ty_completion_eval -- all && break \
    || { [ "$i" = 2 ] && exit 1; sleep 5; }
done

Prevention

When it happens

Trigger: Offline or proxied network blocking package downloads for the fixture's dependencies; stale `uv.lock` relative to the fixture `pyproject.toml`; the fixture's pinned Python version missing; corrupted `.venv` in the temp copy.

Common situations: Running the eval suite on air-gapped machines; after editing fixture dependencies without relocking; after uv or interpreter upgrades; corporate proxies rejecting PyPI.

Related errors


AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16). Data as JSON: /api/errors/2fc7a5af09da85e0. Report an issue: GitHub.