gitbutlerapp/gitbutler · error
Unknown
Unknown
Error message
git fetch worker thread panicked: {reason} What it means
Wraps a panic caught from the dedicated git fetch worker thread. fetch runs git fetch on a spawned thread; a catch_unwind converts any panic payload into this anyhow error with code Unknown, since the fetch never produced a normal result.
Solutions
- Read the inner panic reason in the error chain to find the panicking assertion.
- Check repo integrity (`git fsck`) and retry.
- Run `git fetch <remote>` manually to see if plain git also fails.
- Report as a bug with the panic reason if the underlying CLI fetch succeeds.
Defensive patterns
Strategy: try-catch
Validate before calling
std::process::Command::new("git").args(["fetch", remote]).status()?; // sanity-check repo handles fetch Try / catch
match ctx.fetch(remote, None) {
Err(e) if e.to_string().contains("worker thread panicked") => {
log::error!("fetch panicked: {e:#}"); // inspect chained reason, run git fsck
}
r => r?,
} Prevention
- Run git fsck periodically to catch corruption that trips internal unwraps.
- Keep the library/gitoxide versions updated; panics here are usually bugs.
- Report panics with the full error chain to maintainers.
When it happens
Trigger: The fetch worker thread panics — e.g. invalid UTF-8 in unexpected output, an internal assertion/ref parse failure, or a bug in fetch plumbing triggered by an unusual repo state or malformed remote output.
Common situations: Repos with exotic ref names or malformed packed-refs entries; corrupted .git directory; git hook or remote output that trips an unwrap inside the worker; version-specific gix bugs.
Related errors
- BUG: value must be valid ref name
- BUG: we have to avoid using these legacy types
- no illformed UTF8
- {remote}: {err}
- repo access failed
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/7a6e2b2dc4772a98.
Report an issue: GitHub.
Appendix: source
Thrown at crates/gitbutler-git/src/context.rs:180
)?;
Ok(runtime.block_on(crate::fetch(
repo_path,
crate::tokio::TokioExecutor,
&remote,
on_prompt,
)))
})
.join()
.map_err(|panic| {
let reason = if let Some(message) = panic.downcast_ref::<String>() {
message.clone()
} else if let Some(message) = panic.downcast_ref::<&'static str>() {
(*message).to_owned()
} else {
"unknown panic payload".to_owned()
};
anyhow!("git fetch worker thread panicked: {reason}").context(
but_error::Context::new("git fetch failed unexpectedly").with_code(Code::Unknown),
)
})??;
result.map_err(map_needs_authorization)
}
/// The concrete error type produced by fetch/push through the tokio executor.
type GitError = crate::Error<crate::repository::Error<crate::tokio::TokioExecutor>>;
/// Convert the error into an anyhow error, giving `NeedsAuthorization` failures a message that
/// tells the user what to do about it (see [`needs_authorization_message`]); every other error
/// converts as-is.
fn map_needs_authorization(err: GitError) -> anyhow::Error {
let crate::Error::Backend(crate::repository::RepositoryError::NeedsAuthorization(ref prompt)) =
err
else {
return err.into();
};View on GitHub (pinned to 58e5313667)