{"record":{"id":"abfa7c113d925fe7","repo":"zed-industries/zed","slug":"failed-to-extract-wasi-sdk-archive","errorCode":null,"errorMessage":"failed to extract wasi-sdk archive: {}","messagePattern":"failed to extract wasi-sdk archive: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/extension/src/extension_builder.rs","lineNumber":533,"sourceCode":"        let mut async_file = io::AllowStdIo::new(tar_gz_file);\n        io::copy(response_body, &mut async_file)\n            .await\n            .context(\"streaming response to file\")?;\n        drop(async_file);\n\n        log::info!(\"un-tarring wasi-sdk to {tar_out_dir:?}\");\n\n        // Shell out to tar to extract the archive\n        let tar_output = util::command::new_command(\"tar\")\n            .arg(\"-xzf\")\n            .arg(&tar_gz_path)\n            .arg(\"-C\")\n            .arg(&tar_out_dir)\n            .output()\n            .await\n            .context(\"running tar\")?;\n\n        anyhow::ensure!(\n            tar_output.status.success(),\n            \"failed to extract wasi-sdk archive: {}\",\n            String::from_utf8_lossy(&tar_output.stderr)\n        );\n\n        log::info!(\"finished downloading wasi-sdk\");\n\n        // Clean up the temporary tar.gz file\n        fs::remove_file(&tar_gz_path).ok();\n\n        let inner_dir = fs::read_dir(&tar_out_dir)?\n            .next()\n            .context(\"no content\")?\n            .context(\"reading contents of extracted wasi archive directory\")?\n            .path();\n        match fs::remove_dir_all(wasi_sdk_dir) {\n            Ok(()) => {}\n            Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}","sourceCodeStart":515,"sourceCodeEnd":551,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/extension/src/extension_builder.rs#L515-L551","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"let ok = std::process::Command::new(\"tar\").arg(\"--version\").output()\n    .map(|o| o.status.success()).unwrap_or(false);\nif !ok { eprintln!(\"tar is unavailable; install it before building extensions\"); }","typeGuard":null,"tryCatchPattern":"match install_wasi_sdk_if_needed().await {\n    Err(e) if e.to_string().contains(\"failed to extract wasi-sdk\") => {\n        // delete cached archive and retry once\n        clean_wasi_sdk_cache()?;\n        install_wasi_sdk_if_needed().await?;\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["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."],"tags":["tar","archive","extraction","wasi-sdk","subprocess"],"backgroundTag":"file-read-failed","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-09-12T19:35:53.743Z","contentChangedAt":"2026-09-12T19:35:53.743Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}