gitui-org/gitui · error
set err
Error message
set err
What it means
set_and_notify() locks the Notify's mutex to store the value; the expect("set err") fires only when that mutex is poisoned - a prior panic occurred on a thread holding it. The failed set means a waiter never gets notified, so threads blocked in wait() also stall or die; again a secondary symptom.
Source
Thrown at src/notify_mutex.rs:37
data: Arc::new((Mutex::new(start_value), Condvar::new())),
}
}
///
pub fn wait(&self, condition: T)
where
T: PartialEq + Copy,
{
let mut data = self.data.0.lock().expect("lock err");
while *data != condition {
data = self.data.1.wait(data).expect("wait err");
}
drop(data);
}
///
pub fn set_and_notify(&self, value: T) {
*self.data.0.lock().expect("set err") = value;
self.data.1.notify_one();
}
///
pub fn get(&self) -> T
where
T: Copy,
{
*self.data.0.lock().expect("get err")
}
}
View on GitHub (pinned to 2fa693cb6e)
Solutions
- Diagnose the original panic from the log, not this one.
- Restart the process to clear the poisoned state after fixing the root cause.
- In your own code, move panicking operations outside locked regions and prefer non-poisoning mutexes (parking_lot).
Example fix
// before
*self.data.0.lock().expect("set err") = value;
// after
*self.data.0.lock().unwrap_or_else(|poisoned| poisoned.into_inner()) = value; Defensive patterns
Strategy: fallback
Try / catch
*m.lock().unwrap_or_else(|poisoned| poisoned.into_inner()) = value; cv.notify_one();
Prevention
- Move panicking operations (unwraps, expects) out of locked regions.
- Consider recover-from-poison semantics for state that is written wholesale.
- After any panic in a multithreaded session, restart rather than trusting shared state.
When it happens
Trigger: A producer thread calling set_and_notify() after another thread panicked while holding the mutex; teardown ordering where a panicked worker leaves the lock poisoned and the event loop then tries to publish state.
Common situations: Crash cascades in older builds; debugging sessions where a breakpoint/panic in a critical section leaves shared state locked.
Related errors
AI-assisted analysis of gitui-org/gitui@2fa693cb6e (2026-08-16).
Data as JSON: /api/errors/70f62d81686552c9.
Report an issue: GitHub.