{"record":{"id":"841d129a16176302","repo":"astral-sh/ruff","slug":"the-current-working-directory-contains-non-un-841d12","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":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/ty_server/src/lib.rs","lineNumber":43,"sourceCode":"/// A common result type used in most cases where a\n/// result type is needed.\npub(crate) type Result<T> = anyhow::Result<T>;\n\npub fn run_server() -> anyhow::Result<()> {\n    let _ = print_interactive_warning();\n    let four = NonZeroUsize::new(4).unwrap();\n\n    // by default, we set the number of worker threads to `num_cpus`, with a maximum of 4.\n    let worker_threads = std::thread::available_parallelism()\n        .unwrap_or(four)\n        .min(four);\n\n    let (connection, io_threads) = Connection::stdio();\n\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::anyhow!(\n                \"The current working directory `{}` contains non-Unicode characters. \\\n                    ty only supports Unicode paths.\",\n                path.display()\n            )\n        })?\n    };\n\n    // This is to complement the `LSPSystem` if the document is not available in the index.\n    let fallback_system = Arc::new(OsSystem::new(cwd));\n\n    let server_result = Server::new(worker_threads, connection, fallback_system, false)\n        .context(\"Failed to start server\")?\n        .run();\n\n    let io_result = io_threads.join();\n\n    let result = match (server_result, io_result) {\n        (Ok(()), Ok(())) => Ok(()),","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ty_server/src/lib.rs#L25-L61","documentation":"An anyhow error raised at ty server startup: the process's current working directory contains non-Unicode bytes, and ty's path handling only supports Unicode paths, so no workspace can be rooted there. The original std::env::current_dir failure or invalid path is wrapped with context.","triggerScenarios":"Thrown at crates/ty_server/src/lib.rs:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run ty from a directory whose path is valid Unicode","Pass an explicit workspace folder instead of relying on the current directory"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}