Hmbown/CodeWhale · error
terminal restore was not observed before the deadline
Error message
terminal restore was not observed before the deadline
What it means
After issuing SW_RESTORE, toggle_pin waits up to 800ms via wait_for for the window's maximized state to clear. If the timeout elapses without observing !maximized, it bails: the restore was requested but never took effect, so saved geometry cannot be trusted.
Solutions
- Retry the toggle; transient scheduling delays commonly exceed the 800ms deadline under load.
- Manually restore (un-maximize) the terminal, then re-run toggle_pin so the restore branch is skipped.
- If this recurs, increase the restore wait deadline in window_control.rs (toggle_pin).
Defensive patterns
Strategy: retry
Try / catch
match toggle_pin() {
Err(e) if e.to_string().contains("not observed before the deadline") => retry_once_after_delay(),
other => other?,
} Prevention
- Retry under light system load; the 800ms deadline is tight.
- Treat repeated deadline misses as a signal to raise the timeout.
- Don't invoke toggle during heavy window-manager activity.
- Fall back to non-pinned mode if restore cannot be confirmed.
When it happens
Trigger: ShowWindowAsync(SW_RESTORE) reported success but wait_for(host, 800ms, |observed| !observed.maximized) timed out — the window stayed maximized (or polling couldn't observe the change) before the deadline.
Common situations: Slow or busy window manager delaying the restore; the terminal re-maximizes immediately (window-management policy); heavy system load making the 800ms deadline too tight; polling GetWindowPlacement returning stale maximized state.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
- terminal window change was not observed before the deadline
- terminal host window no longer exists
- terminal host window owner changed
- terminal maximize request was rejected
- terminal restore request was rejected
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/79939f469793e12b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tui/window_control.rs:410
// Retire geometry only when the original owner is gone. A failed
// observation must preserve it for the next restore attempt.
*state = State::new();
PINNED.store(false, Ordering::Release);
return Err(error);
}
let before = observe(host)?;
if !restoring {
state.host = Some(host);
state.was_maximized = before.maximized;
state.saved_rect = Some(before.rect);
if before.maximized {
if !unsafe { ShowWindowAsync(host.hwnd()?, SW_RESTORE) }.as_bool() {
bail!("terminal restore request was rejected");
}
if !wait_for(host, Duration::from_millis(800), |observed| {
!observed.maximized
})? {
bail!("terminal restore was not observed before the deadline");
}
state.saved_rect = Some(observe(host)?.rect);
}
}
let saved = state
.saved_rect
.context("terminal restore geometry is unavailable")?;
let target = Observation {
topmost: !restoring,
maximized: restoring && state.was_maximized,
rect: if restoring {
saved
} else {
RECT {
left: saved.left,
top: saved.top,
right: saved.left + PINNED_W,View on GitHub (pinned to 73e0f67d83)