{"record":{"id":"55bc21113a9a12a4","repo":"astral-sh/ruff","slug":"the-current-working-directory-contains-non-un-55bc21","errorCode":null,"errorMessage":"The current working directory `{}` contains non-Unicode characters. ty only supports Unicode paths.","messagePattern":"The current working directory `(.+?)` contains non-Unicode characters\\. ty only supports Unicode paths\\.","errorType":"console","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/ty_completion_eval/src/main.rs","lineNumber":133,"sourceCode":"\n    fn matches_task(&self, task: &Task) -> bool {\n        self.task_name == task.name\n            && self\n                .file_name\n                .as_ref()\n                .is_none_or(|name| name == task.cursor_name())\n            && self.index.is_none_or(|index| index == task.cursor.index)\n    }\n}\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","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ty_completion_eval/src/main.rs#L115-L151","documentation":"The completion-evaluation harness applies the same startup gate as the main ty binary: it converts the current working directory to a `SystemPathBuf` and aborts when the path contains bytes that are not valid UTF-8, because ty's path layer is Unicode-only on all platforms.","triggerScenarios":"Running `cargo run -p ty_completion_eval` (or the built binary) from a directory whose absolute path includes invalid UTF-8 byte sequences; the harness additionally requires the ruff repo root, so non-standard checkout locations compound the problem.","commonSituations":"Checkouts under legacy-encoded home directories; CI workspaces with byte-mangled components; sandbox/container mounts with non-UTF-8 paths.","solutions":["cd into (or re-checkout the repo under) a fully UTF-8 path and re-run","Rename the offending directory component and retry","Set a UTF-8 locale and recreate any damaged directories"],"exampleFix":"# before\ncd $'ws\\xff/ruff' && cargo run -p ty_completion_eval -- all\n# after\nmv $'ws\\xff' ws-safe && cd ws-safe/ruff && cargo run -p ty_completion_eval -- all","handlingStrategy":"validation","validationCode":"python3 -c 'import os; os.getcwd().encode(\"utf-8\")' 2>/dev/null \\\n  || { echo \"cwd is not valid UTF-8; eval harness cannot run here\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clone the ruff repo into a Unicode-only path","Verify cwd encoding in CI before running eval jobs","Set UTF-8 locales on build agents"],"tags":["unicode","paths","evaluation","environment"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}