{"record":{"id":"2fc7a5af09da85e0","repo":"astral-sh/ruff","slug":"uv-sync-failed-to-run-with-exit-code-code-s-2fc7a5","errorCode":null,"errorMessage":"`uv sync` failed to run with exit code `{code}`, stderr: {stderr}","messagePattern":"`uv sync` failed to run with exit code `(.+?)`, stderr: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ty_completion_eval/src/main.rs","lineNumber":471,"sourceCode":"    ///\n    /// This includes running `uv sync` to set up a full virtual\n    /// environment.\n    fn to_tasks(&self, parent_dst_dir: &SystemPath) -> anyhow::Result<Vec<Task>> {\n        let dir = parent_dst_dir.join(&self.name);\n        let cursors = copy_project(&self.dir, &dir)?;\n        let uv_sync_output = std::process::Command::new(\"uv\")\n            .arg(\"sync\")\n            .current_dir(dir.as_std_path())\n            .output()\n            .with_context(|| format!(\"failed to run `uv sync` in `{dir}`\"))?;\n        if !uv_sync_output.status.success() {\n            let code = uv_sync_output\n                .status\n                .code()\n                .map(|code| code.to_string())\n                .unwrap_or_else(|| \"UNKNOWN\".to_string());\n            let stderr = bstr::BStr::new(&uv_sync_output.stderr);\n            anyhow::bail!(\"`uv sync` failed to run with exit code `{code}`, stderr: {stderr}\")\n        }\n        cursors\n            .into_iter()\n            .map(|cursor| Task::new(&dir, &self.truth, cursor))\n            .collect()\n    }\n}\n\n/// A single cursor directive within a single Python project.\n///\n/// Each cursor directive looks like:\n/// `<CURSOR [expected-module.]expected-symbol>`.\n///\n/// That is, each cursor directive corresponds to a single completion\n/// request, and each request is a single evaluation task.\n#[derive(Clone, Debug)]\nstruct Cursor {\n    /// The path to the file containing this directive.","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ty_completion_eval/src/main.rs#L453-L489","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running the eval suite on air-gapped machines; after editing fixture dependencies without relocking; after uv or interpreter upgrades; corporate proxies rejecting PyPI.","solutions":["Reproduce manually: run `uv sync` inside the original fixture directory under `crates/ty_completion_eval/truth/` and read the full error","Install the pinned interpreter (`uv python install <version>`) or update uv, then retry","Relock the fixture (`uv lock`) after dependency edits","Check UV_HTTP_TIMEOUT / HTTPS_PROXY settings for flaky downloads"],"exampleFix":"# before: eval run aborts with `uv sync` failed ...\ncargo run -p ty_completion_eval -- all\n# after: fix the failing fixture's environment first\ncd crates/ty_completion_eval/truth/<fixture> && uv sync && cd -\ncargo run -p ty_completion_eval -- all","handlingStrategy":"retry","validationCode":"cd crates/ty_completion_eval/truth/$FIXTURE && uv sync --dry-run >/dev/null 2>&1 \\\n  || echo \"warning: fixture env not clean; eval may fail\" >&2","typeGuard":null,"tryCatchPattern":"# shell: bounded retry around the eval run for transient uv failures\nfor i in 1 2; do\n  cargo run -p ty_completion_eval -- all && break \\\n    || { [ \"$i\" = 2 ] && exit 1; sleep 5; }\ndone","preventionTips":["Run `uv sync` in each fixture after pulling changes","Pin interpreters with `uv python install` and keep uv current","Keep network/proxy config (UV_HTTP_TIMEOUT, HTTPS_PROXY) sane on eval machines"],"tags":["evaluation","uv","dependency-sync","environment","network"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}