gitbutlerapp/gitbutler · critical
panic while executing
Error message
panic while executing `{}`: {}
panic backtrace unavailable from hook; conversion backtrace:
{} What it means
Variant of panic conversion in `panic_payload_to_anyhow` used when no backtrace snapshot is available (the hook could not provide one). It reports the panicking function and panic message, notes that the backtrace is unavailable, and instead attaches a backtrace captured at conversion time.
Solutions
- Inspect the function name and panic message to locate the bug
- Fix the panicking unwrap/assert in the named function
- Set RUST_BACKTRACE=1 and ensure the panic hook is installed early so snapshots include backtraces
- Use the conversion backtrace in the message to see the call path into the panicking code
Defensive patterns
Strategy: try-catch
Try / catch
// handle panic-converted errors without a backtrace snapshot
if let Err(e) = wrapped_call() {
let msg = format!("{e:#}");
if msg.contains("panic backtrace unavailable") {
eprintln!("panic in {}: {}", fn_name, msg);
}
return Err(e.into());
} Prevention
- Install the panic-capture hook before spawning threads
- Ensure RUST_BACKTRACE is enabled when configuring the hook
- Panic with string payloads so messages are readable
When it happens
Trigger: A wrapped function panics but the panic hook's snapshot lacks a backtrace (e.g. hook installed without backtrace capture, or payload arrives outside the hook's recording window).
Common situations: Panics in threads or contexts where the custom hook did not run or could not snapshot; RUST_BACKTRACE unset at hook setup; panic payload is a non-string value.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- a committed transaction always materializes a workspace
- anchor is always present in the order at this point
- AtSegment anchor always has oldest commit resolved
- broker already configured
- broker has not been configured
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/695bd0cf0a9c8b5b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-api/src/panic_capture.rs:76
.payload_message
.as_deref()
.or(payload_message.as_deref())
.unwrap_or("panic payload was not a string");
let panic_location = snapshot.location.as_deref().unwrap_or("<unknown location>");
anyhow::anyhow!(
"panic while executing `{}` on thread '{}' ({}) at {}: {}\n\npanic backtrace:\n{}",
function_name,
snapshot.thread_name,
snapshot.thread_id,
panic_location,
panic_message,
snapshot.backtrace
)
} else {
let panic_message = payload_message
.as_deref()
.unwrap_or("panic payload was not a string");
anyhow::anyhow!(
"panic while executing `{}`: {}\n\npanic backtrace unavailable from hook; conversion backtrace:\n{}",
function_name,
panic_message,
std::backtrace::Backtrace::force_capture()
)
}
}
/// Installs a hook that captures panic context and then delegates to the previous hook.
/// Can be called multiple times, but only the first call will install the hook.
pub fn install_panic_hook() {
INSTALL_PANIC_HOOK.call_once(|| {
let previous_hook = panic::take_hook();
panic::set_hook(Box::new(move |panic_info| {
capture_panic_info(panic_info);
previous_hook(panic_info);
}));
});View on GitHub (pinned to 58e5313667)