spacedriveapp/spacedrive · critical

error while running tauri application

Error message

error while running tauri application

What it means

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.

Source

Thrown at apps/tauri/src-tauri/src/main.rs:2250

				if let Some(state) = app.try_state::<Arc<RwLock<DaemonState>>>() {
					let state = state.inner().clone();
					tauri::async_runtime::spawn(async move {
						let daemon_state = state.read().await;

						// Only stop daemon if we started it
						if daemon_state.started_by_us {
							tracing::info!("App closing, shutting down daemon we started");
							// Daemon will be stopped when process exits
							// Could implement graceful shutdown here if needed
						} else {
							tracing::info!("App closing, leaving existing daemon running");
						}
					});
				}
			}
		})
		.run(tauri::generate_context!())
		.expect("error while running tauri application");
}

View on GitHub (pinned to 6dfeccf211)

Solutions

  1. Install Tauri's Linux prerequisites (libwebkit2gtk-4.1-dev, libjavascriptcoregtk-4.1-dev and friends, per Tauri docs)
  2. Run inside a graphical session; for CI use Xvfb plus the webview libraries
  3. cargo clean and rebuild so generate_context! regenerates cleanly
  4. Read the stderr lines immediately above the panic: Tauri logs the concrete cause there
  5. Close other instances that may hold locks or conflicting resources

Example fix

# before: bare run, generic panic
$ ./spacedrive
error while running tauri application

# after: capture the underlying cause before it panics
$ RUST_LOG=trace ./spacedrive 2>tauri.log; tail -n 40 tauri.log
# typically reveals: webkit2gtk missing, no display, or bad context resource
Defensive patterns

Strategy: validation

Validate before calling

# Preflight the Tauri runtime dependencies before launch (Linux)
for lib in libwebkit2gtk-4.1.so.0 libjavascriptcoregtk-4.1.so.0; do
  ldconfig -p | grep -q "$lib" || { echo "missing $lib; install webkit2gtk 4.1"; exit 1; }
done
[ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ] || { echo "no display"; exit 1; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16). Data as JSON: /api/errors/264b39b0fd52885e. Report an issue: GitHub.