gitbutlerapp/gitbutler · error

Archive progress counter thread panicked

Error message

Archive progress counter thread panicked

What it means

In but-debug's dump run_repo, a background thread maintains an archive progress counter. After the archive is finished and the file lock taken, the code joins that thread; a panic inside the thread makes join() return Err, which is mapped to this error. The dump itself completed, but progress accounting failed, so the operation aborts instead of silently losing progress reporting.

Solutions

  1. Retry the `but debug dump` command; if it reproduces, inspect the panic message from join (change the map_err to include the payload for diagnosis)
  2. Report/fix the underlying panic in the counter thread in crates/but-debug/src/command/dump/mod.rs
  3. Run with fewer exotic options (e.g. without --git-only) to work around while tracking down the trigger

Example fix

// before
.join().map_err(|_| anyhow::anyhow!("Archive progress counter thread panicked"))?;
// after
.join().map_err(|e| anyhow::anyhow!("Archive progress counter thread panicked: {e:?}"))?;
Defensive patterns

Strategy: try-catch

Try / catch

match dump.run_repo(...) {
    Err(e) if e.to_string().contains("progress counter thread panicked") => {
        eprintln!("archive written but progress tracking failed: {e:#}");
    }
    other => other?,
}

Prevention

When it happens

Trigger: The progress-counter thread panics (e.g. an unwrap on poisoned state, arithmetic overflow, channel send to a dropped receiver) while a repo archive is being written; also if the thread was already joined/aborted elsewhere.

Common situations: Bugs in the but-debug progress instrumentation surfaced by unusual repo layouts or interrupted output; running dump in environments where thread panics occur (disk full, signal during dump).

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/7a00684b1ea2acda. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-debug/src/command/dump/mod.rs:110

                    repo_args.git_only,
                    diagnostics_files,
                    progress,
                )
            }
        });

        let file = ProgressWriter::new(lock, &progress);
        let mut archive = ArchiveWriter::new(file, &progress);
        if let Some(diagnostics) = &diagnostics {
            archive.add_diagnostics(diagnostics, &layout.worktree_root)?;
        }
        archive.add_repo(&repo, &layout, &output_path, repo_args.git_only)?;
        let file = archive.finish(err)?;
        let lock = file.into_inner();

        let _ = counter
            .join()
            .map_err(|_| anyhow::anyhow!("Archive progress counter thread panicked"))?;
        persist_archive(lock)?;
        Ok(())
    })?;

    writeln!(out, "Archive at: {}", output_path.path.display())?;
    open_archive_dir_unless_requested(
        &output_path.path,
        repo_args.archive.no_open_archive_directory,
    )?;
    Ok(())
}

/// Return the effective current directory selected by `-C`.
fn effective_current_dir(args: &Args) -> Result<PathBuf> {
    Ok(std::env::current_dir()?.join(&args.current_dir))
}

/// Return the default archive path for `repo`, using `suffix` after the repository name.

View on GitHub (pinned to 58e5313667)