gitbutlerapp/gitbutler · error
Update check thread panicked
Error message
Update check thread panicked
What it means
Thrown when the thread spawned to run the update check panicked instead of returning a Result. Thread::join returns Err on panic, and since the panic payload is discarded, this message deliberately loses the original panic cause. The library treats a panicked worker thread as a failed update check.
Solutions
- Retry the update check; a single panicking thread is often transient.
- Reproduce with panic logging enabled (set a panic hook) to find the real panic message, since this wrapper discards it.
- Update the crate/dependencies — a panic in reqwest/tokio/backends is usually a library bug.
- If reproducible, file a bug including the underlying panic backtrace obtained via RUST_BACKTRACE=1 and a panic hook.
Example fix
// before
.join()
.map_err(|_| anyhow::anyhow!("Update check thread panicked"))?;
// after: preserve the panic cause
.join()
.map_err(|payload| {
let msg = payload.downcast_ref::<String>().cloned()
.or_else(|| payload.downcast_ref::<&str>().map(|s| s.to_string()))
.unwrap_or_else(|| "unknown panic".into());
anyhow::anyhow!("Update check thread panicked: {msg}")
})?; Defensive patterns
Strategy: retry
Try / catch
match but_update::check_status(app, &settings, &mut cache) {
Err(e) if e.to_string().contains("thread panicked") => {
// transient internal panic: install a panic hook for diagnosis and retry once
log::warn!("update check worker panicked");
but_update::check_status(app, &settings, &mut cache)
}
other => other?,
} Prevention
- Install a panic hook (std::panic::set_hook) so panics inside worker threads are logged with backtraces.
- Run with RUST_BACKTRACE=1 when reproducing to capture the underlying panic.
- Keep reqwest/tokio/TLS dependencies updated; panics here are usually library bugs.
- Avoid deep recursion or huge payloads on the update-check thread.
When it happens
Trigger: check_status/check_status_with_url when the closure inside std::thread::spawn panics — e.g. an unexpected panic inside the tokio runtime, reqwest, or TLS backend during block_on — and .join() returns Err(_).
Common situations: A bug or abort in a native TLS/runtime dependency triggering a panic; stack exhaustion inside the spawned thread; panics escalated by panic=abort-style settings in embedded environments.
Related errors
- Archive progress counter thread panicked
- Failed to join thread
- Failed to join thread
- thread panicked
- a committed transaction always materializes a workspace
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/d91b03646af817e9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-update/src/check.rs:138
let response = client
.post(url)
.json(&request_body)
.send()
.await
.map_err(|e| anyhow::anyhow!("Request failed: {e}"))?
.error_for_status()
.map_err(|e| anyhow::anyhow!("Server returned error: {e}"))?;
let update_info = response
.json::<CheckUpdateStatus>()
.await
.map_err(|e| anyhow::anyhow!("Failed to parse response: {e}"))?;
Ok(update_info)
})
})
.join()
.map_err(|_| anyhow::anyhow!("Update check thread panicked"))?;
// Save to cache (convert to but_db types)
if let Ok(status) = &result {
let now = chrono::Utc::now();
// Get existing cache to preserve suppression
let existing = trans.update_check().get();
let (suppressed_at, suppress_duration_hours) = existing
.and_then(|cached| cached.suppressed_at.zip(cached.suppress_duration_hours))
.and_then(|(suppressed_at, duration_hours)| {
let suppress_until = suppressed_at + chrono::Duration::hours(duration_hours as i64);
if now > suppress_until {
None
} else {
Some((suppressed_at, duration_hours))
}
})
.unzip();View on GitHub (pinned to 58e5313667)