{"record":{"id":"9dfbab10a9a49894","repo":"BoundaryML/baml","slug":"no-filesystem-is-attached-to-this-server","errorCode":null,"errorMessage":"no filesystem is attached to this server ({})","messagePattern":"no filesystem is attached to this server \\((.+?)\\)","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_lsp/src/discovery.rs","lineNumber":123,"sourceCode":"            tracing::debug!(\n                path = %toml_path.display(),\n                %error,\n                \"unparseable manifest; the project stays unnamed\"\n            );\n        })\n        .ok()?;\n    let name = manifest.package.as_ref()?.name.as_ref()?.trim();\n    (!name.is_empty()).then(|| Name::new(name))\n}\n\n/// A filesystem-less host: reads fail with `Unsupported` and discovery finds\n/// nothing. Documents are still served from their editor buffers.\n#[derive(Debug, Default, Clone, Copy)]\npub struct NoFs;\n\nimpl ProjectFs for NoFs {\n    fn read_to_string(&self, path: &Path) -> std::io::Result<String> {\n        Err(std::io::Error::new(\n            std::io::ErrorKind::Unsupported,\n            format!(\n                \"no filesystem is attached to this server ({})\",\n                path.display()\n            ),\n        ))\n    }\n\n    fn discover_roots(&self, _folder: &Path) -> Vec<DiscoveredRoot> {\n        Vec::new()\n    }\n}\n\n/// The real filesystem, for native hosts.\n#[cfg(not(target_arch = \"wasm32\"))]\n#[derive(Debug, Default, Clone, Copy)]\npub struct NativeFs;\n","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_lsp/src/discovery.rs#L105-L141","documentation":"NoFs::read_to_string always fails with an io::Error of kind Unsupported carrying 'no filesystem is attached to this server ({path})'. It exists so the LSP server can run purely from editor buffers with no disk access; any code path that tries to touch the disk while NoFs is installed triggers it.","triggerScenarios":"Project discovery or document loading calling ProjectFs::read_to_string on a server configured with NoFs (headless/no-filesystem mode); loading a file not present in any open editor buffer.","commonSituations":"Running the LSP in embedded/headless mode and requesting operations on unopened files; tests that forgot to attach a real or in-memory filesystem; the client never sent the file contents via didOpen.","solutions":["Attach a real filesystem implementation to the server instead of NoFs if disk access is intended","Ensure the document is open in the editor (didOpen) so it is served from buffers","Construct NoFs with a proper backing store for headless use (e.g. in-memory map)"],"exampleFix":"// before\nlet fs = NoFs; // server never reads from disk\nlet src = fs.read_to_string(&path)?;\n// after (in-memory fallback)\nmatch buffers.get(&path) {\n    Some(src) => Ok(src.clone()),\n    None => Err(io::Error::new(Unsupported, format!(\"{} not open in editor\", path.display()))),\n}","handlingStrategy":"validation","validationCode":"if matches!(server.fs(), ProjectFs::NoFs) && !buffers.contains_key(&path) {\n    return Err(format!(\"{} is not open in the editor\", path.display()));\n}","typeGuard":"fn has_real_fs(fs: &dyn ProjectFs) -> bool {\n    fs.as_any().downcast_ref::<NoFs>().is_none()\n}","tryCatchPattern":"match fs.read_to_string(&path) {\n    Err(e) if e.kind() == std::io::ErrorKind::Unsupported => serve_from_buffers(&path),\n    other => other,\n}","preventionTips":["Attach a real or in-memory filesystem when running headless workloads","Only request file operations on documents the client has opened (didOpen)"],"tags":["lsp","filesystem","io","rust"],"backgroundTag":"file-read-failed","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}