Kuberwastaken/claurst · error

tar -xzf returned non-zero exit status

Error message

tar -xzf returned non-zero exit status: {}

What it means

Unix extraction path: `tar -xzf` on the downloaded .tar.gz exited non-zero (formatted exit code). The gzip archive could not be extracted — typically a truncated/corrupted download or an unreadable destination.

Solutions

  1. Retry the upgrade to re-download the archive (truncated downloads are common)
  2. Verify disk space and permissions on the staging directory
  3. Test the archive integrity manually: `tar -tzf <archive>`
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src-rust/crates/cli/src/upgrade.rs:262 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10). Data as JSON: /api/errors/b887845e9a4fc5b4. Report an issue: GitHub.

Appendix: source

Thrown at src-rust/crates/cli/src/upgrade.rs:262

                return Ok(());
            }
        }
        // tar -xf works on Windows 10+ via bsdtar.
        let status = std::process::Command::new("tar")
            .args(["-xf", &archive.to_string_lossy(), "-C", &dest.to_string_lossy()])
            .status()
            .context("failed to spawn tar")?;
        if !status.success() {
            bail!("tar -xf returned non-zero exit status: {}", status);
        }
        Ok(())
    } else {
        let status = std::process::Command::new("tar")
            .args(["-xzf", &archive.to_string_lossy(), "-C", &dest.to_string_lossy()])
            .status()
            .context("failed to spawn tar")?;
        if !status.success() {
            bail!("tar -xzf returned non-zero exit status: {}", status);
        }
        Ok(())
    }
}

// Shallow walker (avoids pulling walkdir crate just for this).
fn walkdir_shallow(root: &Path, max_depth: usize) -> Vec<PathBuf> {
    fn rec(dir: &Path, depth_left: usize, out: &mut Vec<PathBuf>) {
        if depth_left == 0 {
            return;
        }
        let read = match std::fs::read_dir(dir) {
            Ok(r) => r,
            Err(_) => return,
        };
        for entry in read.flatten() {
            let path = entry.path();
            if path.is_dir() {

View on GitHub (pinned to b0637c97ec)