{"record":{"id":"e9ec3d851c9b83b2","repo":"astral-sh/ruff","slug":"tried-to-remove-non-existent-workspace-uri-worksp","errorCode":null,"errorMessage":"Tried to remove non-existent workspace URI {workspace_uri}","messagePattern":"Tried to remove non-existent workspace URI (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/ruff_server/src/session/index.rs","lineNumber":193,"sourceCode":"    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,\n        global: &GlobalClientSettings,\n    ) -> Option<DocumentQuery> {\n        let uri = self.uri_for_key(&key)?.clone();\n\n        let document_settings = self","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ruff_server/src/session/index.rs#L175-L211","documentation":"Error \"Tried to remove non-existent workspace URI {workspace_uri}\" thrown in astral-sh/ruff.","triggerScenarios":"Thrown at crates/ruff_server/src/session/index.rs:193 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"}