jlcodes99/cockpit-tools · warning
[Window] startDragging failed:
Error message
[Window] startDragging failed:
What it means
Tauri's `startDragging()` on the current WebviewWindow asks the native window manager to begin an OS-level drag of the window. It fails when the runtime or platform refuses the drag operation (window not found, permission/decoration constraints, or the webview already has another operation in flight). The app only logs a warning since a failed drag is non-fatal.
Source
Thrown at src/App.tsx:3582
}
console.info('[ExternalImport][App] 启动时读取到待处理导入 payload');
void handleExternalProviderImportRawPayload(payload);
})
.catch((error) => {
console.warn('[ExternalImport] 读取待处理导入请求失败:', error);
});
return () => {
canceled = true;
};
}, [handleExternalProviderImportRawPayload]);
// 窗口拖拽处理
const handleDragStart = (event: ReactMouseEvent<HTMLDivElement>) => {
if (event.button !== 0) {
return;
}
void getCurrentWindow().startDragging().catch((error) => {
console.warn('[Window] startDragging failed:', error);
});
};
useEffect(() => {
const handleRequestNavigate = (e: Event) => {
const custom = e as CustomEvent<Page>;
if (custom.detail) {
setPage(custom.detail);
}
};
window.addEventListener('app-request-navigate', handleRequestNavigate as EventListener);
return () => {
window.removeEventListener('app-request-navigate', handleRequestNavigate as EventListener);
};
}, []);
useEffect(() => {
const handleOpenPlatformLayout = (e: Event) => {View on GitHub (pinned to 1ed8b77992)
Solutions
- Check the window still exists before dragging: guard with `await getCurrentWindow().isVisible()` or wrap in a try/catch that ignores NotFound errors.
- Verify the Tauri version and platform: on Linux/Wayland programmatic dragging may be unsupported; test on the target platform.
- Ensure `decorations: false` window config matches the drag-region setup and no overlaying element intercepts the event with a conflicting handler.
- If the error is intermittent during shutdown, debounce or skip drag requests when a close is already in progress.
Example fix
// before
void getCurrentWindow().startDragging().catch((error) => {
console.warn('[Window] startDragging failed:', error);
});
// after
void getCurrentWindow()
.startDragging()
.catch((error) => {
if (String(error).includes('window not found')) return;
console.warn('[Window] startDragging failed:', error);
}); Defensive patterns
Strategy: try-catch
Validate before calling
const win = getCurrentWindow();
if (event.button === 0 && win && document.visibilityState === 'visible') {
void win.startDragging();
} Type guard
function isLeftButton(e: ReactMouseEvent): boolean {
return e.button === 0;
} Try / catch
try {
await getCurrentWindow().startDragging();
} catch (error) {
if (!String(error).includes('window not found')) {
console.warn('[Window] startDragging failed:', error);
}
} Prevention
- Guard drag initiation on left-button and window visibility
- Test frameless dragging on all target platforms (especially Linux/Wayland)
- Skip drag requests once a window close/teardown has started
When it happens
Trigger: User presses the left mouse button (button === 0) on the custom title bar div in MainApp, and `getCurrentWindow().startDragging()` rejects — e.g. the window was closed/minimized mid-call, the platform does not support programmatic drag, or the call races with another window operation.
Common situations: Custom frameless title bars in Tauri apps; rapid clicks during window teardown; Linux/Wayland environments where dragging support differs from Windows/macOS; calling drag on a window handle after the window was destroyed.
Related errors
- [AccountGroups] Failed to load groups: ${String(error)}
- Claude login start 响应缺少关键字段
- 刷新 Codex 配额失败
- [AntigravityRuntime] failed to resolve preferred target:
- [WorkbuddyAutoCheckin] 从 Rust 端获取配置失败,使用本地缓存或默认值:
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/4c6096c4cff2061c.
Report an issue: GitHub.