{"record":{"id":"8d0e4d0a72806f35","repo":"astral-sh/ruff","slug":"truth-does-not-exist-ty-s-completion-evaluation","errorCode":null,"errorMessage":"{truth} does not exist: ty's completion evaluation must be run from the root of the ruff repository","messagePattern":"(.+?) does not exist: ty's completion evaluation must be run from the root of the ruff repository","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ty_completion_eval/src/main.rs","lineNumber":142,"sourceCode":"}\n\nfn main() -> anyhow::Result<ExitCode> {\n    let args = Cli::parse();\n\n    // The base path to which all CLI arguments are relative to.\n    let cwd = {\n        let cwd = std::env::current_dir().context(\"Failed to get the current working directory\")?;\n        SystemPathBuf::from_path_buf(cwd).map_err(|path| {\n            anyhow!(\n                \"The current working directory `{}` contains non-Unicode characters. \\\n                 ty only supports Unicode paths.\",\n                path.display()\n            )\n        })?\n    };\n    // Where we store our truth data.\n    let truth = cwd.join(\"crates\").join(\"ty_completion_eval\").join(\"truth\");\n    anyhow::ensure!(\n        truth.as_std_path().exists(),\n        \"{truth} does not exist: ty's completion evaluation must be run from the root \\\n         of the ruff repository\",\n        truth = truth.as_std_path().display(),\n    );\n\n    // The temporary directory at which we copy our truth\n    // data to. We do this because we can't use the truth\n    // data as-is with its `<CURSOR>` annotations (and perhaps\n    // any other future annotations we add).\n    let mut tmp_eval_dir = tempfile::Builder::new()\n        .prefix(\"ty-completion-eval-\")\n        .tempdir()\n        .context(\"Failed to create temporary directory\")?;\n    let tmp_eval_path = SystemPath::from_std_path(tmp_eval_dir.path())\n        .ok_or_else(|| {\n            anyhow::anyhow!(\n                \"Temporary directory path is not valid UTF-8: {}\",","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/astral-sh/ruff/blob/5bb508f59481c1a02d5c7ff8568b9ffd8a763eef/crates/ty_completion_eval/src/main.rs#L124-L160","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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)"],"exampleFix":"# before\ncd crates/ty_completion_eval && cargo run -- all\n# after\ncd $(git rev-parse --show-toplevel) && cargo run --package ty_completion_eval -- all","handlingStrategy":"validation","validationCode":"import os, sys\nif not os.path.isdir('crates/ty_completion_eval/truth'):\n    sys.exit('Run from the ruff repository root')","typeGuard":null,"tryCatchPattern":"if let Err(e) = eval_main() {\n    let msg = e.to_string();\n    if msg.contains(\"does not exist\") && msg.contains(\"root of the ruff repository\") {\n        eprintln!(\"cd $(git rev-parse --show-toplevel) and retry\");\n    }\n}","preventionTips":["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"],"tags":["working-directory","missing-data","evaluation"],"backgroundTag":"wrong-working-directory","analyzedSha":"5bb508f59481c1a02d5c7ff8568b9ffd8a763eef","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}