Hmbown/CodeWhale · error
window pinning is only supported on Windows
Error message
window pinning is only supported on Windows
What it means
This error is thrown by the non-Windows stub implementation of the window control module. Window pinning (always-on-top / taskbar pin toggle) is implemented only against the Win32 API; on all other platforms `start_toggle` immediately bails with this message instead of performing any operation. It surfaces whenever the pin toggle is invoked on a platform without native support.
Solutions
- Do not invoke the pin toggle on non-Windows platforms; gate the keybinding/command behind `cfg(windows)` or a runtime `windows` check.
- Check availability first with `imp::pinned()`-style feature detection (or expose an `is_supported()` returning `cfg!(windows)`) and hide the feature in the UI on unsupported platforms.
- If pinning is needed on Linux/macOS, implement a platform-specific backend (e.g. via WM hints) instead of relying on this Windows-only module.
Example fix
// before
start_toggle(None)?; // panics/bails on non-Windows
// after
if cfg!(windows) {
start_toggle(None)?;
} Defensive patterns
Strategy: fallback
Validate before calling
if !cfg!(windows) { return; // skip pin toggle } Type guard
fn pinning_supported() -> bool { cfg!(windows) } Prevention
- Gate window-pinning UI affordances behind a Windows check
- Expose and consult an is_supported() predicate before invoking platform APIs
- Test the toggle path on every target platform in CI
When it happens
Trigger: Calling `imp::start_toggle` (the pin-toggle dispatch) on any non-Windows platform (Linux, macOS), since the `#[cfg(not(windows))]` stub unconditionally returns this error.
Common situations: Running the TUI on Linux or macOS and triggering the window-pin toggle keybinding or command; CI or dev environments on non-Windows hosts exercising the pin feature; a build without the Windows cfg path compiled in.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Android dladdr could not locate the updater's loaded image
- Android dladdr returned an empty loaded-image path
- atomic built-in snapshot publication is unsupported on this…
- baseline provenance platform must be macos
- browser opening is unsupported on this platform
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/db41751e37b9265b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tui/window_control.rs:597
drop(state);
reader.join().unwrap();
assert!(observed.is_ok(), "rendering waited for the window worker");
}
#[test]
fn headless_dispatch_rejects_before_resolving_or_changing_a_window() {
let error = start_toggle(None).unwrap_err();
assert!(error.to_string().contains("mailbox is unavailable"));
}
}
}
#[cfg(not(windows))]
mod imp {
pub(super) fn start_toggle(
_completion_tx: Option<tokio::sync::mpsc::Sender<crate::tui::app::DispatchApplyFn>>,
) -> anyhow::Result<()> {
anyhow::bail!("window pinning is only supported on Windows")
}
pub(super) fn pinned() -> bool {
false
}
}
/// Whether host-window control is available on this platform.
/// Only Windows consoles can be driven from inside the TUI.
pub(crate) fn available() -> bool {
cfg!(windows)
}
/// Request a window change without blocking input or claiming it has applied.
/// Both entry points share the worker and its observed completion receipt.
pub(crate) fn toggle_pin(app: &mut crate::tui::app::App) {
if let Err(error) = imp::start_toggle(app.dispatch_completion_tx.clone()) {
show_result(app, Err(error));View on GitHub (pinned to 73e0f67d83)