{"record":{"id":"e1a5ddfdd25270bc","repo":"zed-industries/zed","slug":"failed-to-create-archive-tar-gz","errorCode":null,"errorMessage":"failed to create archive.tar.gz: {}","messagePattern":"failed to create archive\\.tar\\.gz: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/extension_cli/src/main.rs","lineNumber":149,"sourceCode":"    fs.remove_dir(\n        &archive_dir,\n        RemoveOptions {\n            recursive: true,\n            ignore_if_not_exists: true,\n        },\n    )\n    .await\n    .ok();\n    copy_extension_resources(&manifest, &extension_path, &archive_dir, fs.clone())\n        .await\n        .context(\"failed to copy extension resources\")?;\n\n    let tar_output = Command::new(\"tar\")\n        .current_dir(&output_dir)\n        .args([\"-czvf\", \"archive.tar.gz\", \"-C\", \"archive\", \".\"])\n        .output()\n        .await\n        .context(\"failed to run tar\")?;\n    if !tar_output.status.success() {\n        bail!(\n            \"failed to create archive.tar.gz: {}\",\n            String::from_utf8_lossy(&tar_output.stderr)\n        );\n    }\n\n    let manifest_json = serde_json::to_string(&cloud_api_types::ExtensionApiManifest {\n        name: manifest.name,\n        version: manifest.version,\n        description: manifest.description,\n        authors: manifest.authors,\n        schema_version: Some(manifest.schema_version.0),\n        repository: manifest\n            .repository\n            .context(\"missing repository in extension manifest\")?,\n        wasm_api_version: manifest.lib.version.map(|version| version.to_string()),\n        provides: extension_provides,","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/extension_cli/src/main.rs#L131-L167","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before: minimal CI container without tar\nFROM cgr.dev/chainguard/latest\nRUN zed extension pack\n\n# after: ensure tar is present\nFROM cgr.dev/chainguard/latest\nRUN apk add --no-cache tar\nRUN zed extension pack","handlingStrategy":"validation","validationCode":"use std::process::Command;\n\nfn tar_available() -> bool {\n    Command::new(\"tar\")\n        .arg(\"--version\")\n        .output()\n        .map(|out| out.status.success())\n        .unwrap_or(false)\n}\n\n// run before invoking the packaging command\nassert!(tar_available(), \"tar is required on PATH to pack extensions\");","typeGuard":null,"tryCatchPattern":"match Command::new(\"tar\").args([\"-czvf\", \"archive.tar.gz\", \"-C\", \"archive\", \".\"]).output().await {\n    Ok(out) if out.status.success() => { /* proceed */ }\n    Ok(out) => bail!(\"failed to create archive.tar.gz: {}\", String::from_utf8_lossy(&out.stderr)),\n    Err(e) => return Err(e).context(\"failed to run tar\"),\n}","preventionTips":["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."],"tags":["cli","packaging","tar","subprocess","extension"],"backgroundTag":"subprocess-exit-failure","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}