{"record":{"id":"0a8fb545b8cd4b47","repo":"cjpais/Handy","slug":"failed-to-resolve-vad-path","errorCode":null,"errorMessage":"Failed to resolve VAD path: {}","messagePattern":"Failed to resolve VAD path: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"src-tauri/src/managers/audio.rs","lineNumber":604,"sourceCode":"            mute_guard.did_mute = false;\n            debug!(\n                \"Mute removed (restored prev_muted={:?})\",\n                mute_guard.prev_muted\n            );\n        }\n    }\n\n    pub fn preload_vad(&self) -> Result<(), anyhow::Error> {\n        let mut recorder_opt = self.recorder.lock().unwrap();\n        if recorder_opt.is_none() {\n            let vad_path = self\n                .app_handle\n                .path()\n                .resolve(\n                    \"resources/models/silero_vad_v4.onnx\",\n                    tauri::path::BaseDirectory::Resource,\n                )\n                .map_err(|e| anyhow::anyhow!(\"Failed to resolve VAD path: {}\", e))?;\n            let settings = get_settings(&self.app_handle);\n            *recorder_opt = Some(create_audio_recorder(\n                &vad_path,\n                &self.app_handle,\n                settings.selected_channel,\n                Arc::clone(&self.stream_router),\n            )?);\n        }\n        Ok(())\n    }\n\n    pub fn start_microphone_stream(&self) -> Result<(), anyhow::Error> {\n        let mut open_flag = self.is_open.lock().unwrap();\n        if *open_flag {\n            // `is_open` only records that we opened a stream at some point, not\n            // that one is still running. If capture has since failed (mic\n            // unplugged mid-session, USB dropout), rebuild it before the next\n            // recording instead of handing the caller a stalled recorder.","sourceCodeStart":586,"sourceCodeEnd":622,"githubUrl":"https://github.com/cjpais/Handy/blob/c89b7bf38974ad317177389f5bfe28236f0d64e3/src-tauri/src/managers/audio.rs#L586-L622","documentation":"Tauri's path resolver failed while resolving resources/models/silero_vad_v4.onnx against BaseDirectory::Resource — the resource base directory itself could not be determined or the resolution errored. This is distinct from 'file missing': the resolver fails before any filesystem check, typically because the resources directory is absent or mislocated in the installed bundle (resource bundling config or install layout problem).","triggerScenarios":"App packaged without the resources dir (bundle.resources missing the models entry in tauri.conf.json); running the binary from an unexpected location so the resource dir cannot be derived; a broken installer/archive layout where Resources/ sits next to the wrong binary; dev-server run where the resource dir path resolves against a stale build.","commonSituations":"Packaging config drift after moving the resource; distributing a manually-assembled zip that omits Resources/; Linux tarball installs with altered directory structure; NSIS/DMG variants packaging differently than tested.","solutions":["Ensure src-tauri/resources/models/silero_vad_v4.onnx exists and tauri.conf.json bundle.resources includes it, then rebuild the bundle","Inspect the installed app's Resources directory and confirm models/silero_vad_v4.onnx is present next to the binary","If shipping a custom layout, keep the resource dir in the location Tauri derives for your bundle target","Add a startup diagnostic that logs the resolved resource base dir to catch packaging drift early"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// resolve once at startup and verify the target file, so packaging drift is caught immediately\nlet vad_path = app.path()\n    .resolve(\"resources/models/silero_vad_v4.onnx\", tauri::path::BaseDirectory::Resource)\n    .with_context(|| \"resource dir unresolved — check bundle.resources in tauri.conf.json\")?;\nif !vad_path.exists() {\n    anyhow::bail!(\"bundled VAD model missing at {vad_path:?}\");\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = manager.preload_vad() {\n    if e.to_string().contains(\"Failed to resolve VAD path\") {\n        // packaging/install issue, not a runtime one: log the app's resource dir,\n        // prompt reinstall — do not retry, it cannot succeed with this bundle\n    }\n    return Err(e);\n}","preventionTips":["Run a startup self-test resolving every bundled resource path and asserting existence","Keep resources/models listed in tauri.conf.json bundle.resources under change review","For custom install layouts, test that the Resources dir stays where Tauri derives it for your target"],"tags":["rust","tauri","resources","path-resolution","vad","packaging"],"backgroundTag":"resource-path-resolution-failed","analyzedSha":"c89b7bf38974ad317177389f5bfe28236f0d64e3","analyzedAt":"2026-08-17T10:29:55.597Z","contentChangedAt":"2026-08-17T10:29:55.597Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}