{"record":{"id":"fccf6f9c3dfc5e38","repo":"astral-sh/ruff","slug":"workspace-uri-is-not-valid-utf8","errorCode":null,"errorMessage":"Workspace URI is not valid UTF8","messagePattern":"Workspace URI is not valid UTF8","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/ty_server/src/session.rs","lineNumber":1671,"sourceCode":"    ///\n    /// This returns `true` when this workspace is added and `false`\n    /// when it has already been added.\n    ///\n    /// It's the caller's responsibility to later call\n    /// [`Session::request_uninitialized_workspace_folder_configurations`] with\n    /// the resolved settings for this workspace. Registering and initializing\n    /// a workspace is a two-step process because the workspace are announced\n    /// to the server during the `initialize` request, but the resolved\n    /// settings are only available after the client has responded to the\n    /// `workspace/configuration` request.\n    fn register(&mut self, uri: Uri) -> anyhow::Result<bool> {\n        let path = uri\n            .to_file_path()\n            .map_err(|()| anyhow!(\"Workspace URI is not a file or directory: {uri:?}\"))?;\n\n        // Realistically I don't think this can fail because we got the path from a Uri\n        let system_path = SystemPathBuf::from_path_buf(path)\n            .map_err(|_| anyhow!(\"Workspace URI is not valid UTF8\"))?;\n\n        if self.workspaces.contains_key(&system_path) {\n            return Ok(false);\n        }\n\n        self.workspaces.insert(\n            system_path,\n            Workspace {\n                uri,\n                settings: Arc::new(WorkspaceSettings::default()),\n                initialized: false,\n            },\n        );\n        Ok(true)\n    }\n\n    /// Unregisters a workspace folder at the given path.\n    ///","sourceCodeStart":1653,"sourceCodeEnd":1689,"githubUrl":"https://github.com/astral-sh/ruff/blob/5bb508f59481c1a02d5c7ff8568b9ffd8a763eef/crates/ty_server/src/session.rs#L1653-L1689","documentation":"An anyhow error raised while registering a workspace: the workspace URI's path component is not valid UTF-8. ty's path types require Unicode, so the URI cannot be converted to a workspace path and registration fails.","triggerScenarios":"Thrown at crates/ty_server/src/session.rs:1754 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a workspace URI whose path is valid UTF-8","Re-open the project from a Unicode-named directory"],"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"}