{"record":{"id":"264b39b0fd52885e","repo":"spacedriveapp/spacedrive","slug":"error-while-running-tauri-application","errorCode":null,"errorMessage":"error while running tauri application","messagePattern":"error while running tauri application","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"apps/tauri/src-tauri/src/main.rs","lineNumber":2250,"sourceCode":"\t\t\t\tif let Some(state) = app.try_state::<Arc<RwLock<DaemonState>>>() {\n\t\t\t\t\tlet state = state.inner().clone();\n\t\t\t\t\ttauri::async_runtime::spawn(async move {\n\t\t\t\t\t\tlet daemon_state = state.read().await;\n\n\t\t\t\t\t\t// Only stop daemon if we started it\n\t\t\t\t\t\tif daemon_state.started_by_us {\n\t\t\t\t\t\t\ttracing::info!(\"App closing, shutting down daemon we started\");\n\t\t\t\t\t\t\t// Daemon will be stopped when process exits\n\t\t\t\t\t\t\t// Could implement graceful shutdown here if needed\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttracing::info!(\"App closing, leaving existing daemon running\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\t.run(tauri::generate_context!())\n\t\t.expect(\"error while running tauri application\");\n}\n","sourceCodeStart":2232,"sourceCodeEnd":2252,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/apps/tauri/src-tauri/src/main.rs#L2232-L2252","documentation":"Builder::run starts the Tauri event loop with the compiled-in generate_context! bundle and expects it to run until exit. Any startup failure panics with this generic message: missing webkit2gtk on Linux, no display, corrupted generated resources (icons/capabilities), or conflicting single-instance locks. The specific cause is logged to stderr before the panic.","triggerScenarios":"Linux without webkit2gtk-4.1/libjavascriptcoregtk installed; missing DISPLAY/Wayland session; stale or corrupted target artifacts after branch switches breaking generate_context!; port/resource conflicts with another instance.","commonSituations":"First run on a fresh Linux machine missing Tauri system dependencies; CI/docker launch without a display or without the webview libs; cargo build interrupted leaving partial artifacts.","solutions":["Install Tauri's Linux prerequisites (libwebkit2gtk-4.1-dev, libjavascriptcoregtk-4.1-dev and friends, per Tauri docs)","Run inside a graphical session; for CI use Xvfb plus the webview libraries","cargo clean and rebuild so generate_context! regenerates cleanly","Read the stderr lines immediately above the panic: Tauri logs the concrete cause there","Close other instances that may hold locks or conflicting resources"],"exampleFix":"# before: bare run, generic panic\n$ ./spacedrive\nerror while running tauri application\n\n# after: capture the underlying cause before it panics\n$ RUST_LOG=trace ./spacedrive 2>tauri.log; tail -n 40 tauri.log\n# typically reveals: webkit2gtk missing, no display, or bad context resource","handlingStrategy":"validation","validationCode":"# Preflight the Tauri runtime dependencies before launch (Linux)\nfor lib in libwebkit2gtk-4.1.so.0 libjavascriptcoregtk-4.1.so.0; do\n  ldconfig -p | grep -q \"$lib\" || { echo \"missing $lib; install webkit2gtk 4.1\"; exit 1; }\ndone\n[ -n \"$DISPLAY\" ] || [ -n \"$WAYLAND_DISPLAY\" ] || { echo \"no display\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install Tauri system dependencies as part of the dev-machine setup script","Run with RUST_LOG=trace when diagnosing startup panics; the cause precedes the generic expect","cargo clean after switching branches with icon/capability changes"],"tags":["tauri","runtime","webview","panic"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}