zed-industries/zed · error · anyhow::Error
failed to create archive.tar.gz: {}
Error message
failed to create archive.tar.gz: {} What it means
The extension CLI builds the submit-able bundle by shelling out to the system tar binary (tar -czvf archive.tar.gz -C archive .) from the output directory. This bail fires when that child process exits with a non-zero status, and the message embeds tar's stderr verbatim. It is a wrapper around an external-tool failure, not a Rust-side packaging error.
Source
Thrown at crates/extension_cli/src/main.rs:149
fs.remove_dir(
&archive_dir,
RemoveOptions {
recursive: true,
ignore_if_not_exists: true,
},
)
.await
.ok();
copy_extension_resources(&manifest, &extension_path, &archive_dir, fs.clone())
.await
.context("failed to copy extension resources")?;
let tar_output = Command::new("tar")
.current_dir(&output_dir)
.args(["-czvf", "archive.tar.gz", "-C", "archive", "."])
.output()
.await
.context("failed to run tar")?;
if !tar_output.status.success() {
bail!(
"failed to create archive.tar.gz: {}",
String::from_utf8_lossy(&tar_output.stderr)
);
}
let manifest_json = serde_json::to_string(&cloud_api_types::ExtensionApiManifest {
name: manifest.name,
version: manifest.version,
description: manifest.description,
authors: manifest.authors,
schema_version: Some(manifest.schema_version.0),
repository: manifest
.repository
.context("missing repository in extension manifest")?,
wasm_api_version: manifest.lib.version.map(|version| version.to_string()),
provides: extension_provides,View on GitHub (pinned to 9d272b0363)
Solutions
- Run `tar --version` in the same shell/environment the CLI runs in; if missing, install tar (Windows 10+ ships bsdtar, Linux: apt/apk add tar) or add it to PATH.
- Read the tar stderr embedded in the bail message — it names the actual failing operation (permission, disk, missing file).
- Check the output directory is writable and has disk space (`df -h`, `ls -ld <output-dir>`).
- Re-run the pack command from the project root so the relative `archive` staging directory resolves.
Example fix
# before: minimal CI container without tar FROM cgr.dev/chainguard/latest RUN zed extension pack # after: ensure tar is present FROM cgr.dev/chainguard/latest RUN apk add --no-cache tar RUN zed extension pack
Defensive patterns
Strategy: validation
Validate before calling
use std::process::Command;
fn tar_available() -> bool {
Command::new("tar")
.arg("--version")
.output()
.map(|out| out.status.success())
.unwrap_or(false)
}
// run before invoking the packaging command
assert!(tar_available(), "tar is required on PATH to pack extensions"); Try / catch
match Command::new("tar").args(["-czvf", "archive.tar.gz", "-C", "archive", "."]).output().await {
Ok(out) if out.status.success() => { /* proceed */ }
Ok(out) => bail!("failed to create archive.tar.gz: {}", String::from_utf8_lossy(&out.stderr)),
Err(e) => return Err(e).context("failed to run tar"),
} Prevention
- Include tar in CI images explicitly (apt-get install tar / apk add tar).
- Run packaging from the project root so relative staging paths resolve.
- Fail the pipeline early with a tar --version preflight check instead of at pack time.
When it happens
Trigger: Running `zed extension pack` (ExtensionPack command in crates/extension_cli/src/main.rs) when `tar` is not on PATH, when the `archive` staging directory cannot be read, when the output directory is read-only or full, or when tar itself reports an error on stderr and exits non-zero.
Common situations: Windows machines without bsdtar available; minimal CI images (distroless, micro) that omit tar; corporate build sandboxes that strip PATH; read-only or quota-exhausted output directories; running the CLI from a directory whose relative `archive` path does not resolve.
Related errors
- Theme "{theme_name}" is using a deprecated style property: s
- failed to extract wasi-sdk archive: {}
- extension dir {} is not an absolute path
- failed to compile {} parser with clang: {}
- grammar directory '{}' already exists, but is not a git clon
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20).
Data as JSON: /api/errors/e1a5ddfdd25270bc.
Report an issue: GitHub.