{"record":{"id":"9a4f1fc25926c1ca","repo":"BloopAI/vibe-kanban","slug":"error-while-building-tauri-application","errorCode":null,"errorMessage":"error while building tauri application","messagePattern":"error while building tauri application","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/tauri-app/src/main.rs","lineNumber":296,"sourceCode":"        })\n        .on_window_event(move |window, event| {\n            match event {\n                tauri::WindowEvent::CloseRequested { api, .. } => {\n                    // Hide the window instead of closing it so the app keeps\n                    // running in the background (agents/processes stay alive).\n                    // The dock icon stays visible so users can click it to reopen.\n                    api.prevent_close();\n                    let _ = window.hide();\n                }\n                tauri::WindowEvent::Destroyed => {\n                    // Only fires on actual app exit (e.g. Cmd+Q).\n                    shutdown_token_for_event.cancel();\n                }\n                _ => {}\n            }\n        })\n        .build(tauri::generate_context!())\n        .expect(\"error while building tauri application\")\n        .run(move |_app, _event| {\n            // macOS: clicking the dock icon when the window is hidden should reopen it.\n            #[cfg(target_os = \"macos\")]\n            if let tauri::RunEvent::Reopen { .. } = _event {\n                show_window(_app);\n            }\n\n            // Install any pending update when the app exits (e.g. Cmd+Q)\n            // so the next launch uses the new version.\n            if let tauri::RunEvent::Exit = _event {\n                // block_on is safe here — we're on the main (AppKit) thread,\n                // not inside the tokio runtime.\n                tauri::async_runtime::block_on(install_pending_update(_app, &pending_for_exit));\n            }\n        });\n}\n\n/// Disable trackpad/touchpad pinch-to-zoom on macOS while keeping Cmd+/- zoom.","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/crates/tauri-app/src/main.rs#L278-L314","documentation":"Tauri's `Builder::build(tauri::generate_context!())` returns a Result; this `.expect()` panics when the application cannot be constructed. Common causes baked into generate_context! are missing/invalid tauri.conf.json fields, unreadable app icons referenced in the config, invalid window configuration, or failures resolving plugin/asset initialization at build-of-runtime.","triggerScenarios":"Launching the built Tauri app where `tauri.conf.json` is invalid or its referenced resources (icons, frontendDist) are missing at runtime, a tauri plugin's initialization returns an error, the identifier/packageInfo in the config is malformed, or generate_context! embedded assets fail to load (e.g. dist folder not built).","commonSituations":"Running the dev binary before `pnpm build` produced the frontendDist; renaming/moving icons listed in tauri.conf.json; invalid `identifier` (not reverse-DNS) breaking plugin init on macOS/Windows; version mismatch between tauri crate and CLI after an upgrade.","solutions":["Run the frontend build so the configured frontendDist exists before launching (`pnpm build` / `pnpm tauri dev`).","Validate tauri.conf.json: check identifier, icons paths, window config, and that all referenced asset files exist.","Replace expect with proper error handling to surface the underlying error: `.unwrap_or_else(|e| { eprintln!(\"tauri build error: {e}\"); std::process::exit(1); })` to see the real cause.","Align @tauri-apps/cli and tauri crate versions (`cargo update -p tauri`, matching minor versions) after upgrades."],"exampleFix":"// before\n.build(tauri::generate_context!())\n.expect(\"error while building tauri application\")\n// after\n.build(tauri::generate_context!())\n.unwrap_or_else(|e| {\n    eprintln!(\"Failed to build tauri application: {e:#}\");\n    std::process::exit(1);\n})","handlingStrategy":"try-catch","validationCode":"// Pre-flight checks before build()\nfn preflight() -> Result<(), String> {\n    let dist = std::path::Path::new(\"dist\");\n    if !dist.exists() { return Err(\"frontendDist missing: run the frontend build first\".into()); }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"// Surface the underlying tauri error instead of a bare panic:\n.build(tauri::generate_context!())\n.unwrap_or_else(|e| {\n    eprintln!(\"Failed to build tauri application: {e:#}\");\n    std::process::exit(1);\n})","preventionTips":["Always build the frontend before launching the packaged/dev binary.","Keep icon/resource paths in tauri.conf.json relative and committed to the repo.","Use a valid reverse-DNS identifier in tauri.conf.json.","Pin matching versions of tauri crate and @tauri-apps/cli; run `tauri dev` once after upgrades.","Replace bare expects on tauri build/run with logged, exit-with-error handling to capture diagnostics."],"tags":["rust","tauri","desktop-app","startup","configuration"],"backgroundTag":"tauri-app-build-failed","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}