{"record":{"id":"62642f7d3d0b1be2","repo":"warpdotdev/warp","slug":"can-t-read-files-when-not-on-a-local-filesystem","errorCode":null,"errorMessage":"Can't read files when not on a local filesystem","messagePattern":"Can't read files when not on a local filesystem","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/ai/blocklist/action_model/execute.rs","lineNumber":1119,"sourceCode":"///\n/// If any files do not exist, they are included in the `failed_files` field of the result.\n///\n/// Binary files larger than the per-file byte limit are skipped and reported as\n/// too large. Text files are truncated at the per-file limit via line streaming.\n/// If `max_file_bytes` is provided, it overrides the default per-file limit\n/// ([`MAX_FILE_READ_BYTES`]). Pass `None` to use the default.\n/// If `max_batch_bytes` is provided, the cumulative content of all files is capped at that\n/// budget; once exceeded, remaining files are reported as too large.\n#[cfg_attr(not(feature = \"local_fs\"), allow(unused_variables))]\npub async fn read_local_file_context(\n    file_names: &[FileLocations],\n    current_working_directory: Option<String>,\n    shell: Option<ShellLaunchData>,\n    max_file_bytes: Option<usize>,\n    max_batch_bytes: Option<usize>,\n) -> anyhow::Result<ReadFileContextResult> {\n    #[cfg(not(feature = \"local_fs\"))]\n    return Err(anyhow::anyhow!(\n        \"Can't read files when not on a local filesystem\"\n    ));\n\n    #[cfg(feature = \"local_fs\")]\n    {\n        let mut result = ReadFileContextResult {\n            file_contexts: Vec::new(),\n            failed_files: Vec::new(),\n        };\n\n        let mut batch_bytes_remaining = max_batch_bytes;\n\n        for file in file_names {\n            let absolute_file_path = PathBuf::from(host_native_absolute_path(\n                &file.name,\n                &shell,\n                &current_working_directory,\n            ));","sourceCodeStart":1101,"sourceCodeEnd":1137,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/blocklist/action_model/execute.rs#L1101-L1137","documentation":"read_local_file_context is compiled without the local_fs cargo feature (non-desktop targets such as WASM). In that configuration the function ignores its arguments and unconditionally returns this error, so any agent file-context read attempt on a non-local-filesystem build fails.","triggerScenarios":"Building the app crate with cfg(not(feature = \"local_fs\")) - i.e. web/WASM targets - and calling read_local_file_context from agent tooling (execute.rs:1119-1122).","commonSituations":"New code path reaches file-read tooling in a WASM build; feature flags reorganized so local_fs is no longer enabled for a desktop target; tests exercising the function in a default (feature-less) configuration.","solutions":["Enable the local_fs feature for desktop builds that call this API","Gate callers on #[cfg(feature = \"local_fs\")] and provide a remote/agent-side fetch path for web targets","In tests, build with the feature or assert the capability error explicitly"],"exampleFix":"// before\nlet ctx = read_local_file_context(&names, cwd, shell, None, None).await?;\n\n// after\n#[cfg(feature = \"local_fs\")]\nlet ctx = read_local_file_context(&names, cwd, shell, None, None).await?;\n#[cfg(not(feature = \"local_fs\"))]\nlet ctx = fetch_file_context_via_remote_agent(&names).await?; // web path","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"#[cfg(feature = \"local_fs\")]\nfn can_read_local_files() -> bool { true }\n#[cfg(not(feature = \"local_fs\"))]\nfn can_read_local_files() -> bool { false }","tryCatchPattern":"match read_local_file_context(&names, cwd, shell, None, None).await {\n    Err(e) if e.to_string().starts_with(\"Can't read files when not on a local filesystem\") => {\n        fetch_file_context_via_remote_agent(&names).await // web fallback\n    }\n    r => r?,\n}","preventionTips":["cfg-gate every call site of read_local_file_context alongside the function itself","Provide and test a remote-agent file-context path for non-local builds","Add a compile-time or unit-test assertion that desktop builds enable local_fs"],"tags":["rust","warp","feature-flags","wasm","filesystem","compile-time"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}