zed-industries/zed · error

Failed to copy file ( ) to WSL

Error message

Failed to copy file {}({}) to WSL {:?}: {}

What it means

In WslRemoteConnection::copy_via_wslpath_and_cp (called from upload_file): converting the source path via wslpath or copying it with `cp` into the WSL filesystem failed. Part of the remote-server upload fallback path.

Solutions

  1. Check free space and permissions inside the WSL distro
  2. Verify the WSL distro is running and wslpath conversion works
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/remote/src/transport/wsl.rs:331 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/6ca98ecb216fd081. Report an issue: GitHub.

Appendix: source

Thrown at crates/remote/src/transport/wsl.rs:331

                        format!("failed to stream file into WSL after /mnt copy failed: {cp_err:#}")
                    })?;
            }
        }

        log::info!("uploaded remote server in {:?}", t0.elapsed());
        Ok(())
    }

    async fn copy_via_wslpath_and_cp(&self, src_path: &Path, dst_path: &RelPath) -> Result<()> {
        let src_path_in_wsl = self.windows_path_to_wsl_path(src_path).await?;
        let cp = self.shell_kind.prepend_command_prefix("cp");
        self.run_wsl_command(
            &cp,
            &["-f", &src_path_in_wsl, &dst_path.display(PathStyle::Unix)],
        )
        .await
        .map_err(|e| {
            anyhow!(
                "Failed to copy file {}({}) to WSL {:?}: {}",
                src_path.display(),
                src_path_in_wsl,
                dst_path,
                e
            )
        })
    }

    async fn stream_file_into_wsl(&self, src_path: &Path, dst_path: &RelPath) -> Result<()> {
        let mut file = fs::File::open(src_path).await.with_context(|| {
            format!(
                "failed to open {} for streaming into WSL",
                src_path.display()
            )
        })?;

        let dst_posix = dst_path.display(PathStyle::Unix);

View on GitHub (pinned to f4178619ac)