{"record":{"id":"7a00684b1ea2acda","repo":"gitbutlerapp/gitbutler","slug":"archive-progress-counter-thread-panicked","errorCode":null,"errorMessage":"Archive progress counter thread panicked","messagePattern":"Archive progress counter thread panicked","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-debug/src/command/dump/mod.rs","lineNumber":110,"sourceCode":"                    repo_args.git_only,\n                    diagnostics_files,\n                    progress,\n                )\n            }\n        });\n\n        let file = ProgressWriter::new(lock, &progress);\n        let mut archive = ArchiveWriter::new(file, &progress);\n        if let Some(diagnostics) = &diagnostics {\n            archive.add_diagnostics(diagnostics, &layout.worktree_root)?;\n        }\n        archive.add_repo(&repo, &layout, &output_path, repo_args.git_only)?;\n        let file = archive.finish(err)?;\n        let lock = file.into_inner();\n\n        let _ = counter\n            .join()\n            .map_err(|_| anyhow::anyhow!(\"Archive progress counter thread panicked\"))?;\n        persist_archive(lock)?;\n        Ok(())\n    })?;\n\n    writeln!(out, \"Archive at: {}\", output_path.path.display())?;\n    open_archive_dir_unless_requested(\n        &output_path.path,\n        repo_args.archive.no_open_archive_directory,\n    )?;\n    Ok(())\n}\n\n/// Return the effective current directory selected by `-C`.\nfn effective_current_dir(args: &Args) -> Result<PathBuf> {\n    Ok(std::env::current_dir()?.join(&args.current_dir))\n}\n\n/// Return the default archive path for `repo`, using `suffix` after the repository name.","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-debug/src/command/dump/mod.rs#L92-L128","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["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)","Report/fix the underlying panic in the counter thread in crates/but-debug/src/command/dump/mod.rs","Run with fewer exotic options (e.g. without --git-only) to work around while tracking down the trigger"],"exampleFix":"// before\n.join().map_err(|_| anyhow::anyhow!(\"Archive progress counter thread panicked\"))?;\n// after\n.join().map_err(|e| anyhow::anyhow!(\"Archive progress counter thread panicked: {e:?}\"))?;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match dump.run_repo(...) {\n    Err(e) if e.to_string().contains(\"progress counter thread panicked\") => {\n        eprintln!(\"archive written but progress tracking failed: {e:#}\");\n    }\n    other => other?,\n}","preventionTips":["Retry `but debug dump` when it fails; check for reproducible panics","Run with standard options to isolate option-specific triggers","Report the panic with the full error chain to the but-debug maintainers"],"tags":["threading","panic","debug-tooling"],"backgroundTag":"thread-interrupted","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}