Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: auto-reload on IndexedDB disconnect + demote FFmpeg info stderr to debug

Louis Beaumontc6edea22fb07
diff --git a/apps/screenpipe-app-tauri/app/layout.tsx b/apps/screenpipe-app-tauri/app/layout.tsx
index d3563e230..77230aa6a 100644
--- a/apps/screenpipe-app-tauri/app/layout.tsx
+++ b/apps/screenpipe-app-tauri/app/layout.tsx
@@ -47,6 +47,17 @@ export default function RootLayout({
}
} catch {}
+ // Auto-reload on IndexedDB disconnect (APP-2E, 21 users)
+ // WKWebView's IndexedDB server can crash; the page becomes unusable.
+ const handleUnhandledRejection = (e: PromiseRejectionEvent) => {
+ const msg = String(e.reason?.message || e.reason || "");
+ if (msg.includes("Connection to Indexed Database server lost")) {
+ console.warn("IndexedDB server lost — reloading page");
+ window.location.reload();
+ }
+ };
+ window.addEventListener("unhandledrejection", handleUnhandledRejection);
+
const logs: string[] = [];
const MAX_LOGS = 1000;
const originalConsole = { ...console };
@@ -87,6 +98,10 @@ export default function RootLayout({
});
};
});
+
+ return () => {
+ window.removeEventListener("unhandledrejection", handleUnhandledRejection);
+ };
}, []);
return (
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 3fb871a2c..bd277142d 100755
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9048,7 +9048,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.0.365"
+version = "2.0.366"
dependencies = [
"anyhow",
"async-stream",
diff --git a/crates/screenpipe-server/src/video.rs b/crates/screenpipe-server/src/video.rs
index 115c14548..e221da3ab 100644
--- a/crates/screenpipe-server/src/video.rs
+++ b/crates/screenpipe-server/src/video.rs
@@ -6,7 +6,7 @@ use screenpipe_core::{find_ffmpeg_path, Language};
use screenpipe_vision::{
capture_screenshot_by_window::WindowFilters, continuous_capture, CaptureResult, OcrEngine,
};
-use std::borrow::Cow;
+
use std::path::PathBuf;
use std::process::Stdio;
use std::sync::atomic::{AtomicU64, Ordering};
@@ -782,8 +782,11 @@ pub async fn finish_ffmpeg_process(child: Child, stdin: Option<ChildStdin>) {
Ok(output) => {
debug!("FFmpeg process exited with status: {}", output.status);
let stderr = String::from_utf8_lossy(&output.stderr);
- if !output.status.success() && stderr != Cow::Borrowed("") {
- error!("FFmpeg stderr: {}", stderr);
+ if !output.status.success() && !stderr.is_empty() {
+ error!("FFmpeg failed (exit {}): {}", output.status, stderr);
+ } else if !stderr.is_empty() {
+ // FFmpeg writes metadata/codec info to stderr by design — not an error
+ debug!("FFmpeg stderr (info): {}", stderr);
}
}
Err(e) => error!("Failed to wait for FFmpeg process: {}", e),