{"record":{"id":"8d7e610574e1f0a5","repo":"Hmbown/CodeWhale","slug":"terminal-maximize-request-was-rejected","errorCode":null,"errorMessage":"terminal maximize request was rejected","messagePattern":"terminal maximize request was rejected","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/window_control.rs","lineNumber":457,"sourceCode":"                SetWindowPos(\n                    hwnd,\n                    Some(if restoring {\n                        HWND_NOTOPMOST\n                    } else {\n                        HWND_TOPMOST\n                    }),\n                    target.rect.left,\n                    target.rect.top,\n                    target.rect.right - target.rect.left,\n                    target.rect.bottom - target.rect.top,\n                    if target.maximized {\n                        flags | SWP_NOMOVE | SWP_NOSIZE\n                    } else {\n                        flags\n                    },\n                )?;\n                if target.maximized && !ShowWindowAsync(hwnd, SW_MAXIMIZE).as_bool() {\n                    bail!(\"terminal maximize request was rejected\");\n                }\n            }\n            let applied = wait_for(host, Duration::from_millis(400), |observed| {\n                observed.matches(target)\n            })?;\n            tracing::info!(\n                applied,\n                restoring,\n                attempt,\n                \"window_control: observed window result\"\n            );\n            if applied {\n                if restoring {\n                    *state = State::new();\n                }\n                return Ok(target.topmost);\n            }\n        }","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/window_control.rs#L439-L475","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match toggle_pin() {\n    Err(e) if e.to_string().contains(\"maximize request was rejected\") => retry_with_backoff(2),\n    other => other?,\n}","preventionTips":["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."],"tags":["windows","win32","showwindow","terminal-window"],"backgroundTag":"unsupported-operation","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}