{"record":{"id":"924d3bf43ea7e6a0","repo":"astral-sh/ruff","slug":"workspace-path-is-not-valid-utf-8","errorCode":null,"errorMessage":"Workspace path is not valid UTF-8: {}","messagePattern":"Workspace path is not valid UTF-8: (.+?)","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/ty_server/src/session.rs","lineNumber":996,"sourceCode":"    /// This removes the workspace folder and its associated project database,\n    /// and clears diagnostics for any documents that were in the workspace.\n    ///\n    /// # Errors\n    ///\n    /// This returns an error if the workspace folder has already been removed\n    /// or otherwise could not be found.\n    pub(crate) fn remove_workspace_folder(\n        &mut self,\n        client: &Client,\n        uri: &Uri,\n    ) -> anyhow::Result<()> {\n        tracing::info!(\"Removing workspace folder: {uri}\");\n\n        let path = uri\n            .to_file_path()\n            .map_err(|()| anyhow!(\"Workspace URI is not a file path: {uri}\"))?;\n        let workspace_path = SystemPathBuf::from_path_buf(path)\n            .map_err(|path| anyhow!(\"Workspace path is not valid UTF-8: {}\", path.display()))?;\n\n        anyhow::ensure!(\n            self.workspaces.unregister(&workspace_path),\n            \"Workspace not found: {uri}\",\n        );\n\n        // Note that it is somewhat unclear whether we actually need to\n        // clear diagnostics here. It seems that, at least in the case\n        // of VS Code, it will auto-clear any diagnostics not found in\n        // the workspace diagnostic response. Moreover, VS Code will\n        // re-request workspace diagnostics after removing a workspace\n        // folder.\n        //\n        // For now, we keep unconditionally clearing diagnostics on\n        // opened text documents for reasons of good sense, but it's\n        // possible that we don't even need to do that (when workspace\n        // diagnostics are enabled).\n        //","sourceCodeStart":978,"sourceCodeEnd":1014,"githubUrl":"https://github.com/astral-sh/ruff/blob/5bb508f59481c1a02d5c7ff8568b9ffd8a763eef/crates/ty_server/src/session.rs#L978-L1014","documentation":"An anyhow error raised while removing a workspace folder: the folder's URI converted to a file path, but the resulting path is not valid UTF-8. ty only supports Unicode paths, so the folder cannot be matched against known workspaces.","triggerScenarios":"Thrown at crates/ty_server/src/session.rs:988 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure workspace folder URIs use Unicode paths","Re-open the workspace from a valid UTF-8 path"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}