{"record":{"id":"fa12d5e2839c55df","repo":"astral-sh/ruff","slug":"failed-to-convert-workspace-uri-to-file-path-wor","errorCode":null,"errorMessage":"Failed to convert workspace URI to file path: {workspace_uri}","messagePattern":"Failed to convert workspace URI to file path: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/ruff_server/src/session/index.rs","lineNumber":188,"sourceCode":"\n        notebook.update(cells, metadata, new_version, encoding)?;\n        Ok(())\n    }\n\n    pub(super) fn open_workspace_folder(\n        &mut self,\n        uri: Uri,\n        global: &GlobalClientSettings,\n        client: &Client,\n    ) -> crate::Result<()> {\n        // TODO(jane): Find a way for workspace client settings to be added or changed dynamically.\n        self.settings\n            .register_workspace(&Workspace::new(uri), global, client)\n    }\n\n    pub(super) fn close_workspace_folder(&mut self, workspace_uri: &Uri) -> crate::Result<()> {\n        let workspace_path = workspace_uri.to_file_path().map_err(|()| {\n            anyhow!(\"Failed to convert workspace URI to file path: {workspace_uri}\")\n        })?;\n\n        self.settings\n            .remove(&workspace_path)\n            .ok_or_else(|| anyhow!(\"Tried to remove non-existent workspace URI {workspace_uri}\"))?;\n\n        // O(n) complexity, which isn't ideal... but this is an uncommon operation.\n        self.documents\n            .retain(|uri, _| !Path::new(uri.path()).starts_with(&workspace_path));\n        self.notebook_cells\n            .retain(|_, uri| !Path::new(uri.path()).starts_with(&workspace_path));\n\n        Ok(())\n    }\n\n    pub(super) fn make_document_ref(\n        &self,\n        key: DocumentKey,","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ruff_server/src/session/index.rs#L170-L206","documentation":"Error \"Failed to convert workspace URI to file path: {workspace_uri}\" thrown in astral-sh/ruff.","triggerScenarios":"Thrown at crates/ruff_server/src/session/index.rs:188 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}