Zackriya-Solutions/meetily · critical

Failed to get app data dir

Error message

Failed to get app data dir

What it means

The Whisper engine's set_models_directory mirrors the Parakeet one: it .expect()s Tauri's app_data_dir(), which errors when the bundle identifier is missing/invalid in tauri.conf.json or the platform home/data directory cannot be resolved. The panic fires during app setup, before whisper_init can run.

Source

Thrown at frontend/src-tauri/src/whisper_engine/commands.rs:17

use crate::whisper_engine::{ModelInfo, WhisperEngine};
use std::sync::{Arc, Mutex};
use std::path::PathBuf;
use tauri::{command, Emitter, Manager, AppHandle, Runtime};
use crate::config::WHISPER_MODEL_CATALOG;

// Global whisper engine
pub static WHISPER_ENGINE: Mutex<Option<Arc<WhisperEngine>>> = Mutex::new(None);

// Global models directory path (set during app initialization)
static MODELS_DIR: Mutex<Option<PathBuf>> = Mutex::new(None);

/// Initialize the models directory path using app_data_dir
/// This should be called during app setup before whisper_init
pub fn set_models_directory<R: Runtime>(app: &AppHandle<R>) {
    let app_data_dir = app.path().app_data_dir()
        .expect("Failed to get app data dir");

    let models_dir = app_data_dir.join("models");

    // Create directory if it doesn't exist
    if !models_dir.exists() {
        if let Err(e) = std::fs::create_dir_all(&models_dir) {
            log::error!("Failed to create models directory: {}", e);
            return;
        }
    }

    log::info!("Models directory set to: {}", models_dir.display());

    let mut guard = MODELS_DIR.lock().unwrap();
    *guard = Some(models_dir);
}

/// Get the configured models directory

View on GitHub (pinned to 0281737d87)

Solutions

  1. Set a valid `identifier` in tauri.conf.json — one fix covers all app_data_dir expects in the app
  2. Replace expect with a logged early-return so a missing dir disables Whisper with a UI message instead of crashing
  3. Verify HOME/known-folder resolution in the launch environment (print app.path().app_data_dir() in debug builds)
  4. Rebuild after the config change so the identifier is re-embedded

Example fix

// before
let app_data_dir = app.path().app_data_dir()
    .expect("Failed to get app data dir");

// after
let Ok(app_data_dir) = app.path().app_data_dir() else {
    log::error!("app_data_dir unresolved; whisper models disabled");
    return;
};
Defensive patterns

Strategy: validation

Validate before calling

if app.path().app_data_dir().is_err() {
    log::error!("app_data_dir unresolved; whisper disabled this session");
    return;
}

Try / catch

let Ok(app_data_dir) = app.path().app_data_dir() else {
    log::error!("app_data_dir unresolved; whisper models disabled");
    return;
};

Prevention

When it happens

Trigger: App setup calls set_models_directory with an unset/invalid `identifier` (underscores or placeholder values) or in an environment lacking HOME; the setup thread panics and launch aborts before model load.

Common situations: Dev configs with a stripped tauri.conf.json, identifier renames, packaged binaries launched from services or CI sandboxes without a user profile.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16). Data as JSON: /api/errors/f0bcb93618290303. Report an issue: GitHub.