zed-industries/zed · error
failed to extract wasi-sdk archive: {}
Error message
failed to extract wasi-sdk archive: {} What it means
Thrown by update_wasi_sdk_if_needed after downloading the wasi-sdk archive and running `tar` to extract it; if tar exits non-zero the stderr is wrapped in this error. It indicates the extracted archive is corrupt, in a format tar cannot handle, or the destination directory is unusable.
Source
Thrown at crates/extension/src/extension_builder.rs:533
let mut async_file = io::AllowStdIo::new(tar_gz_file);
io::copy(response_body, &mut async_file)
.await
.context("streaming response to file")?;
drop(async_file);
log::info!("un-tarring wasi-sdk to {tar_out_dir:?}");
// Shell out to tar to extract the archive
let tar_output = util::command::new_command("tar")
.arg("-xzf")
.arg(&tar_gz_path)
.arg("-C")
.arg(&tar_out_dir)
.output()
.await
.context("running tar")?;
anyhow::ensure!(
tar_output.status.success(),
"failed to extract wasi-sdk archive: {}",
String::from_utf8_lossy(&tar_output.stderr)
);
log::info!("finished downloading wasi-sdk");
// Clean up the temporary tar.gz file
fs::remove_file(&tar_gz_path).ok();
let inner_dir = fs::read_dir(&tar_out_dir)?
.next()
.context("no content")?
.context("reading contents of extracted wasi archive directory")?
.path();
match fs::remove_dir_all(wasi_sdk_dir) {
Ok(()) => {}
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}View on GitHub (pinned to 9d272b0363)
Solutions
- Delete the cached wasi-sdk archive/download directory and retry so a fresh, complete archive is downloaded.
- Run the same `tar -x` command manually on the downloaded archive to see the real tar error.
- Verify network/proxy integrity if the download was truncated (compare file size or checksum with the GitHub release).
- Install a tar that supports the archive's compression (e.g. `apt install tar zstd` / update macOS bsdtar).
- Ensure the extraction directory exists and is writable by the current user.
Defensive patterns
Strategy: retry
Validate before calling
let ok = std::process::Command::new("tar").arg("--version").output()
.map(|o| o.status.success()).unwrap_or(false);
if !ok { eprintln!("tar is unavailable; install it before building extensions"); } Try / catch
match install_wasi_sdk_if_needed().await {
Err(e) if e.to_string().contains("failed to extract wasi-sdk") => {
// delete cached archive and retry once
clean_wasi_sdk_cache()?;
install_wasi_sdk_if_needed().await?;
}
Err(e) => return Err(e),
Ok(v) => v,
} Prevention
- Keep the system tar (and its compression backends like zstd/xz) up to date.
- Clear the wasi-sdk download cache after failed downloads so corrupt archives are not reused.
- Ensure adequate disk space in the cache/extraction directory before downloading.
- Check archive integrity (size/checksum) when behind proxies or unstable networks.
When it happens
Trigger: install_wasi_sdk_if_needed downloads a wasi-sdk release archive and shells out to `tar -x ... -C <tar_out_dir>`; the error fires whenever that tar process returns a failure status, e.g. truncated download, unsupported compression, or unwritable target directory.
Common situations: Corrupt or partially downloaded wasi-sdk archive due to flaky network or a proxy; a wasi-sdk release asset whose compression format the system tar lacks support for (e.g. zstd on old tar); disk full or permission problems in the extraction directory; no `tar` binary on the system (e.g. minimal Windows installs).
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- failed to create archive.tar.gz: {}
- failed to compile {} parser with clang: {}
- unknown benchmark '{benchmark_id}' (valid: {valid})
- judge proxy exited before becoming ready
- verifier produced no results (exit {completed.returncode}):
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-09-12).
Data as JSON: /api/errors/abfa7c113d925fe7.
Report an issue: GitHub.