warpdotdev/warp · error

Can't read files when not on a local filesystem

Error message

Can't read files when not on a local filesystem

What it means

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.

Source

Thrown at app/src/ai/blocklist/action_model/execute.rs:1119

///
/// If any files do not exist, they are included in the `failed_files` field of the result.
///
/// Binary files larger than the per-file byte limit are skipped and reported as
/// too large. Text files are truncated at the per-file limit via line streaming.
/// If `max_file_bytes` is provided, it overrides the default per-file limit
/// ([`MAX_FILE_READ_BYTES`]). Pass `None` to use the default.
/// If `max_batch_bytes` is provided, the cumulative content of all files is capped at that
/// budget; once exceeded, remaining files are reported as too large.
#[cfg_attr(not(feature = "local_fs"), allow(unused_variables))]
pub async fn read_local_file_context(
    file_names: &[FileLocations],
    current_working_directory: Option<String>,
    shell: Option<ShellLaunchData>,
    max_file_bytes: Option<usize>,
    max_batch_bytes: Option<usize>,
) -> anyhow::Result<ReadFileContextResult> {
    #[cfg(not(feature = "local_fs"))]
    return Err(anyhow::anyhow!(
        "Can't read files when not on a local filesystem"
    ));

    #[cfg(feature = "local_fs")]
    {
        let mut result = ReadFileContextResult {
            file_contexts: Vec::new(),
            failed_files: Vec::new(),
        };

        let mut batch_bytes_remaining = max_batch_bytes;

        for file in file_names {
            let absolute_file_path = PathBuf::from(host_native_absolute_path(
                &file.name,
                &shell,
                &current_working_directory,
            ));

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Enable the local_fs feature for desktop builds that call this API
  2. Gate callers on #[cfg(feature = "local_fs")] and provide a remote/agent-side fetch path for web targets
  3. In tests, build with the feature or assert the capability error explicitly

Example fix

// before
let ctx = read_local_file_context(&names, cwd, shell, None, None).await?;

// after
#[cfg(feature = "local_fs")]
let ctx = read_local_file_context(&names, cwd, shell, None, None).await?;
#[cfg(not(feature = "local_fs"))]
let ctx = fetch_file_context_via_remote_agent(&names).await?; // web path
Defensive patterns

Strategy: type-guard

Type guard

#[cfg(feature = "local_fs")]
fn can_read_local_files() -> bool { true }
#[cfg(not(feature = "local_fs"))]
fn can_read_local_files() -> bool { false }

Try / catch

match read_local_file_context(&names, cwd, shell, None, None).await {
    Err(e) if e.to_string().starts_with("Can't read files when not on a local filesystem") => {
        fetch_file_context_via_remote_agent(&names).await // web fallback
    }
    r => r?,
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16). Data as JSON: /api/errors/62642f7d3d0b1be2. Report an issue: GitHub.