Hmbown/CodeWhale · error
terminal maximize request was rejected
Error message
terminal maximize request was rejected
What it means
When applying the target window state, if the target is maximized, toggle_pin calls ShowWindowAsync(hwnd, SW_MAXIMIZE) and bails if it returns FALSE — Windows refused the maximize request. The code treats this as fatal rather than leaving the window half-applied.
Solutions
- Retry toggle_pin; the failure is often transient.
- Verify the terminal isn't elevated while the TUI process is not (UIPI restriction) — run at matching integrity levels.
- Maximize the terminal manually and use a non-maximized pin target, skipping the maximize call.
- Re-capture the host window if its state or ownership changed.
Defensive patterns
Strategy: retry
Try / catch
match toggle_pin() {
Err(e) if e.to_string().contains("maximize request was rejected") => retry_with_backoff(2),
other => other?,
} Prevention
- Retry ShowWindowAsync(SW_MAXIMIZE) once before failing.
- Match integrity levels between the TUI process and the terminal (UIPI).
- Verify the target monitor/desktop is available before maximizing.
- Fall back to a non-maximized pin target when maximize is refused.
When it happens
Trigger: toggle_pin applying a maximized target state where ShowWindowAsync(SW_MAXIMIZE) returns as_bool() == false — the OS rejected the async maximize for the host window.
Common situations: Targeting a window on a different virtual desktop or monitor being reconfigured; UIPI blocking a non-elevated process from maximizing an elevated terminal; the window transitioning states concurrently with the user's actions.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- terminal restore request was rejected
- terminal host window no longer exists
- terminal host window owner changed
- terminal restore was not observed before the deadline
- terminal window change was not observed before the deadline
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/8d7e610574e1f0a5.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tui/window_control.rs:457
SetWindowPos(
hwnd,
Some(if restoring {
HWND_NOTOPMOST
} else {
HWND_TOPMOST
}),
target.rect.left,
target.rect.top,
target.rect.right - target.rect.left,
target.rect.bottom - target.rect.top,
if target.maximized {
flags | SWP_NOMOVE | SWP_NOSIZE
} else {
flags
},
)?;
if target.maximized && !ShowWindowAsync(hwnd, SW_MAXIMIZE).as_bool() {
bail!("terminal maximize request was rejected");
}
}
let applied = wait_for(host, Duration::from_millis(400), |observed| {
observed.matches(target)
})?;
tracing::info!(
applied,
restoring,
attempt,
"window_control: observed window result"
);
if applied {
if restoring {
*state = State::new();
}
return Ok(target.topmost);
}
}View on GitHub (pinned to 73e0f67d83)