{"record":{"id":"6dc68873bf88ac90","repo":"astral-sh/ruff","slug":"document-controller-not-available-at-uri","errorCode":null,"errorMessage":"Document controller not available at `{uri}`","messagePattern":"Document controller not available at `(.+?)`","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/ruff_server/src/session/index.rs","lineNumber":352,"sourceCode":"    }\n\n    pub(super) fn client_settings(&self, key: &DocumentKey) -> Option<Arc<ClientSettings>> {\n        let uri = self.uri_for_key(key)?;\n        let WorkspaceSettings {\n            client_settings, ..\n        } = self.settings_for_uri(uri)?;\n        Some(client_settings.clone())\n    }\n\n    fn document_controller_for_key(\n        &mut self,\n        key: &DocumentKey,\n    ) -> crate::Result<&mut DocumentController> {\n        let Some(uri) = self.uri_for_key(key).cloned() else {\n            anyhow::bail!(\"Tried to open unavailable document `{key}`\");\n        };\n        let Some(controller) = self.documents.get_mut(&uri) else {\n            anyhow::bail!(\"Document controller not available at `{uri}`\");\n        };\n        Ok(controller)\n    }\n\n    fn uri_for_key<'a>(&'a self, key: &'a DocumentKey) -> Option<&'a Uri> {\n        match key {\n            DocumentKey::Notebook(path) | DocumentKey::Text(path) => Some(path),\n            DocumentKey::NotebookCell(uri) => self.notebook_cells.get(uri),\n        }\n    }\n\n    fn settings_for_uri(&self, uri: &Uri) -> Option<&WorkspaceSettings> {\n        if let Ok(path) = uri.to_file_path() {\n            self.settings_for_path(&path)\n        } else {\n            // If there's only a single workspace, use that configuration for an untitled document.\n            if self.settings.len() == 1 {\n                tracing::debug!(","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ruff_server/src/session/index.rs#L334-L370","documentation":"Error \"Document controller not available at `{uri}`\" thrown in astral-sh/ruff.","triggerScenarios":"Thrown at crates/ruff_server/src/session/index.rs:352 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"}