cjpais/Handy · error

Failed to resolve VAD path: {}

Error message

Failed to resolve VAD path: {}

What it means

Tauri's path().resolve("resources/models/silero_vad_v4.onnx", BaseDirectory::Resource) failed while preload_vad lazily built the recorder. resolve() errors when the Resource base directory itself cannot be determined for the platform, not merely when the file is absent (joining a missing file still succeeds).

Source

Thrown at src-tauri/src/managers/audio.rs:541

            mute_guard.did_mute = false;
            debug!(
                "Mute removed (restored prev_muted={:?})",
                mute_guard.prev_muted
            );
        }
    }

    pub fn preload_vad(&self) -> Result<(), anyhow::Error> {
        let mut recorder_opt = self.recorder.lock().unwrap();
        if recorder_opt.is_none() {
            let vad_path = self
                .app_handle
                .path()
                .resolve(
                    "resources/models/silero_vad_v4.onnx",
                    tauri::path::BaseDirectory::Resource,
                )
                .map_err(|e| anyhow::anyhow!("Failed to resolve VAD path: {}", e))?;
            let settings = get_settings(&self.app_handle);
            *recorder_opt = Some(create_audio_recorder(
                &vad_path,
                &self.app_handle,
                settings.selected_channel,
                Arc::clone(&self.stream_router),
            )?);
        }
        Ok(())
    }

    pub fn start_microphone_stream(&self) -> Result<(), anyhow::Error> {
        let mut open_flag = self.is_open.lock().unwrap();
        if *open_flag {
            // `is_open` only records that we opened a stream at some point, not
            // that one is still running. If the capture worker has since exited
            // (mic unplugged mid-session, USB dropout), returning Ok here hands
            // the caller a dead recorder: it captures nothing, then fails in

View on GitHub (pinned to 98a4d80cce)

Solutions

  1. Run through the supported entry points: `bun run tauri dev` or the built/installed app bundle
  2. Verify resources/models/** is listed under bundle resources in tauri.conf.json
  3. Confirm silero_vad_v4.onnx exists in the packaged resources directory next to the binary
  4. If packaging relocates the binary, keep the resources directory layout intact
Defensive patterns

Strategy: validation

Validate before calling

// fail fast at startup instead of at first recording
let resource_dir = app_handle
    .path()
    .resource_dir()
    .map_err(|e| anyhow::anyhow!("resource dir unavailable (run via `tauri dev` or the installed bundle): {e}"))?;
let vad_file = resource_dir.join("resources/models/silero_vad_v4.onnx");
if !vad_file.is_file() {
    anyhow::bail!("missing VAD model: {vad_file:?}");
}

Try / catch

match app_handle.path().resolve(rel, tauri::path::BaseDirectory::Resource) {
    Ok(p) => p,
    Err(e) => anyhow::bail!("cannot resolve resource {rel}: {e} — are you running the raw binary?"),
}

Prevention

When it happens

Trigger: Running the raw target/debug binary directly instead of `bun run tauri dev` or an installed bundle, so the platform resource dir is not where the binary expects; a bundle identifier/context misconfiguration; executable moved out of its .app bundle (macOS) or install prefix (Linux).

Common situations: Developers launching the binary from target/ for quick tests; CI or distro packaging that relocates the executable without its resources; flatpak/snap confinement hiding the real resource path.

Related errors


AI-assisted analysis of cjpais/Handy@98a4d80cce (2026-08-16). Data as JSON: /api/errors/0a8fb545b8cd4b47. Report an issue: GitHub.