{"record":{"id":"2e0ea8458375a782","repo":"astral-sh/ruff","slug":"input-is-not-a-text-document-path","errorCode":null,"errorMessage":"Input is not a text document: {path}","messagePattern":"Input is not a text document: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ty_server/src/system.rs","lineNumber":338,"sourceCode":"\n/// Rejects commands without retaining the LSP document index.\nstruct UntrustedWorkspaceExecutor;\n\nimpl CommandExecutor for UntrustedWorkspaceExecutor {\n    fn execute(&self, _command: Command) -> Result<Output> {\n        Err(std::io::Error::new(\n            std::io::ErrorKind::PermissionDenied,\n            \"external commands are disabled in an untrusted workspace\",\n        ))\n    }\n\n    fn dyn_clone(&self) -> Box<dyn CommandExecutor> {\n        Box::new(Self)\n    }\n}\n\nfn not_a_text_document(path: impl Display) -> std::io::Error {\n    std::io::Error::new(\n        std::io::ErrorKind::InvalidInput,\n        format!(\"Input is not a text document: {path}\"),\n    )\n}\n\nfn virtual_path_not_found(path: impl Display) -> std::io::Error {\n    std::io::Error::new(\n        std::io::ErrorKind::NotFound,\n        format!(\"Virtual path does not exist: {path}\"),\n    )\n}\n\n/// Helper function to get the [`FileRevision`] of the given document.\nfn document_revision(document: &Document, index: &Index) -> FileRevision {\n    // The file revision is just an opaque number which doesn't have any significant meaning other\n    // than that the file has changed if the revisions are different.\n    #[expect(clippy::cast_sign_loss)]\n    match document {","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ty_server/src/system.rs#L320-L356","documentation":"A std::io::Error (InvalidInput) built by not_a_text_document in the ty server's virtual file system: a read targeted a virtual path that is not one of the open LSP text documents. The server only serves file contents for documents it holds in memory.","triggerScenarios":"Thrown at crates/ty_server/src/system.rs:338 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open the file in the editor so it becomes a known text document","Read from the real filesystem path instead of the virtual document path"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}