astral-sh/ruff · error · anyhow::Error
Failed to convert workspace URI to file path: {workspace_uri
Error message
Failed to convert workspace URI to file path: {workspace_uri} What it means
Error "Failed to convert workspace URI to file path: {workspace_uri}" thrown in astral-sh/ruff.
Source
Thrown at crates/ruff_server/src/session/index.rs:188
notebook.update(cells, metadata, new_version, encoding)?;
Ok(())
}
pub(super) fn open_workspace_folder(
&mut self,
uri: Uri,
global: &GlobalClientSettings,
client: &Client,
) -> crate::Result<()> {
// TODO(jane): Find a way for workspace client settings to be added or changed dynamically.
self.settings
.register_workspace(&Workspace::new(uri), global, client)
}
pub(super) fn close_workspace_folder(&mut self, workspace_uri: &Uri) -> crate::Result<()> {
let workspace_path = workspace_uri.to_file_path().map_err(|()| {
anyhow!("Failed to convert workspace URI to file path: {workspace_uri}")
})?;
self.settings
.remove(&workspace_path)
.ok_or_else(|| anyhow!("Tried to remove non-existent workspace URI {workspace_uri}"))?;
// O(n) complexity, which isn't ideal... but this is an uncommon operation.
self.documents
.retain(|uri, _| !Path::new(uri.path()).starts_with(&workspace_path));
self.notebook_cells
.retain(|_, uri| !Path::new(uri.path()).starts_with(&workspace_path));
Ok(())
}
pub(super) fn make_document_ref(
&self,
key: DocumentKey,View on GitHub (pinned to 672bb4edf0)
When it happens
Trigger: Thrown at crates/ruff_server/src/session/index.rs:188 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16).
Data as JSON: /api/errors/fa12d5e2839c55df.
Report an issue: GitHub.