astral-sh/ruff · error
does not exist: ty's completion evaluation must be run from…
Error message
{truth} does not exist: ty's completion evaluation must be run from the root of the ruff repository What it means
ty_completion_eval loads its truth fixtures from `<cwd>/crates/ty_completion_eval/truth`. If that directory does not exist, `anyhow::ensure!` fails with this message explaining the tool must be run from the root of the ruff repository.
Solutions
- cd to the ruff repository root and rerun the evaluation
- Ensure the checkout includes `crates/ty_completion_eval/truth` (un-sparse the checkout or restore deleted files)
Example fix
# before cd crates/ty_completion_eval && cargo run -- all # after cd $(git rev-parse --show-toplevel) && cargo run --package ty_completion_eval -- all
Defensive patterns
Strategy: validation
Validate before calling
import os, sys
if not os.path.isdir('crates/ty_completion_eval/truth'):
sys.exit('Run from the ruff repository root') Try / catch
if let Err(e) = eval_main() {
let msg = e.to_string();
if msg.contains("does not exist") && msg.contains("root of the ruff repository") {
eprintln!("cd $(git rev-parse --show-toplevel) and retry");
}
} Prevention
- Always run the binary from the repository root: `cargo run --package ty_completion_eval -- ...` from the checkout top
- Avoid sparse/partial checkouts that drop the truth directory
- Add a shell wrapper that cds to `git rev-parse --show-toplevel` first
When it happens
Trigger: Executing the ty_completion_eval binary outside the ruff repository root, or from a subdirectory/checkout where `crates/ty_completion_eval/truth` is missing (e.g. partial clone, crate copied elsewhere).
Common situations: Running `cargo run -p ty_completion_eval` from within the crate directory instead of the repo root; sparse checkouts excluding the truth fixtures; running the installed binary from an arbitrary directory.
Related errors
AI-assisted analysis of astral-sh/ruff@5bb508f594 (2026-09-05).
Data as JSON: /api/errors/8d0e4d0a72806f35.
Report an issue: GitHub.
Appendix: source
Thrown at crates/ty_completion_eval/src/main.rs:142
}
fn main() -> anyhow::Result<ExitCode> {
let args = Cli::parse();
// The base path to which all CLI arguments are relative to.
let cwd = {
let cwd = std::env::current_dir().context("Failed to get the current working directory")?;
SystemPathBuf::from_path_buf(cwd).map_err(|path| {
anyhow!(
"The current working directory `{}` contains non-Unicode characters. \
ty only supports Unicode paths.",
path.display()
)
})?
};
// Where we store our truth data.
let truth = cwd.join("crates").join("ty_completion_eval").join("truth");
anyhow::ensure!(
truth.as_std_path().exists(),
"{truth} does not exist: ty's completion evaluation must be run from the root \
of the ruff repository",
truth = truth.as_std_path().display(),
);
// The temporary directory at which we copy our truth
// data to. We do this because we can't use the truth
// data as-is with its `<CURSOR>` annotations (and perhaps
// any other future annotations we add).
let mut tmp_eval_dir = tempfile::Builder::new()
.prefix("ty-completion-eval-")
.tempdir()
.context("Failed to create temporary directory")?;
let tmp_eval_path = SystemPath::from_std_path(tmp_eval_dir.path())
.ok_or_else(|| {
anyhow::anyhow!(
"Temporary directory path is not valid UTF-8: {}",View on GitHub (pinned to 5bb508f594)