{"record":{"id":"8e121cb2ec4b8328","repo":"BoundaryML/baml","slug":"file-not-found","errorCode":null,"errorMessage":"File not found: {}","messagePattern":"File not found: (.+?)","errorType":"error_code","errorClass":"LspError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_lsp/src/error.rs","lineNumber":33,"sourceCode":"    #[error(\"{0}\")]\n    RequestExtractError(lsp_server::ExtractError<lsp_server::Request>),\n    #[error(\"Request not supported: {0}\")]\n    RequestNotSupported(String),\n    #[error(\"Failed to serialize request result: {0}\")]\n    RequestSerializeError(serde_json::Error),\n    /// The client's sink is gone; nothing more can be delivered.\n    #[error(\"Client closed\")]\n    ClientClosed,\n    /// Bounded transport backpressure (LSP `RequestFailed`, `-32803`).\n    #[error(\"LSP outbound sink is saturated\")]\n    OutboundSaturated,\n    /// A frame larger than the transport limit (LSP `RequestFailed`,\n    /// `-32803`).\n    #[error(\"LSP outbound frame exceeds the transport limit\")]\n    OutboundOversized,\n    #[error(\"Invalid command arguments for command: {command}: {message}\")]\n    InvalidCommandArguments { command: String, message: String },\n    #[error(\"File not found: {}\", .0.display())]\n    FileNotFound(PathBuf),\n    #[error(\"Path is invalid: {}: {message}\", path.display())]\n    InvalidPath { path: PathBuf, message: String },\n    /// The document's path is under no known source root.\n    #[error(\"No source root contains {}\", .0.display())]\n    NoRootForPath(PathBuf),\n    /// Cancellation claimed the response while the request was queued or\n    /// running (LSP `RequestCanceled`, `-32800`).\n    #[error(\"Request canceled: {0}\")]\n    RequestCanceled(String),\n    /// The request's snapshot became stale under an applied source change\n    /// (LSP `ContentModified`, `-32801`).\n    #[error(\"Content modified: {0}\")]\n    ContentModified(String),\n    /// A valid request that cannot be served right now (LSP `RequestFailed`,\n    /// `-32803`).\n    #[error(\"{0}\")]\n    RequestFailed(String),","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_lsp/src/error.rs#L15-L51","documentation":"LspError::FileNotFound is returned when the server is asked to operate on a file whose path does not exist on disk. The display form is 'File not found: <path>' using the PathBuf's display representation. It is thrown instead of panicking so the LSP client receives a clean error response for requests that reference a missing document.","triggerScenarios":"A textDocument request (definition, hover, formatting, etc.) references a URI that was never opened and does not exist; the file was deleted between the client's index and the request; a path is resolved relative to the wrong working directory.","commonSituations":"Editor holds a stale buffer for a deleted/moved .baml file; client sends absolute URIs that don't resolve on the server's filesystem (e.g. remote-container path mismatch); typo'd or reconstructed file paths in generated tooling.","solutions":["Verify the file exists at the exact path in the error message on the machine running the language server.","Re-open or re-save the document in the editor so the client sends a didOpen notification before other requests.","Check that the client and server agree on the workspace root / mount points (containers, remote SSH, WSL).","Refresh the client's file index if files were moved or deleted externally."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const fs = require('fs');\nfunction fileExists(uri) {\n  const p = new URL(uri).pathname;\n  return fs.existsSync(p) && fs.statSync(p).isFile();\n}","typeGuard":null,"tryCatchPattern":"try {\n  await request('textDocument/definition', params);\n} catch (e) {\n  if (e.message?.startsWith('File not found')) {\n    console.warn('Document missing on server filesystem:', params.textDocument.uri);\n    return [];\n  }\n  throw e;\n}","preventionTips":["Send didOpen for every document before issuing analysis requests","Check filesystem existence when running client and server in different mounts/containers","Purge stale URIs from client caches after file moves/deletes"],"tags":["lsp","filesystem","path","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}