Zackriya-Solutions/meetily · critical

Failed to get app data dir

Error message

Failed to get app data dir

What it means

set_models_directory resolves the Parakeet models directory from Tauri's app_data_dir() and .expect()s the Result. app_data_dir() fails when the bundle identifier is missing/invalid in tauri.conf.json or the platform home/data base dir is unresolvable; the panic fires during app setup, before any model can load.

Source

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

use crate::parakeet_engine::{ModelInfo, ModelStatus, ParakeetEngine, DownloadProgress};
use std::path::PathBuf;
use std::sync::Mutex;
use std::sync::Arc;
use tauri::{command, Emitter, AppHandle, Manager, Runtime};

// Global parakeet engine
pub static PARAKEET_ENGINE: Mutex<Option<Arc<ParakeetEngine>>> = 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 parakeet_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!("Parakeet 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 (reverse-DNS, no underscores) — fixes every app_data_dir site
  2. Return early with a logged error instead of expect: log::error and skip engine init, letting the UI show 'models unavailable'
  3. Ensure the environment provides a home directory when running headless
  4. Rebuild so generate_context! embeds the corrected identifier

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; parakeet models disabled");
    return;
};
Defensive patterns

Strategy: validation

Validate before calling

if app.path().app_data_dir().is_err() {
    log::error!("app_data_dir unresolved; parakeet disabled this session");
    return; // skip engine init instead of crashing setup
}

Try / catch

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

Prevention

When it happens

Trigger: App setup calls set_models_directory when `identifier` is unset/invalid (e.g. contains underscores) or the process runs without HOME (systemd service, minimal container), panicking the setup thread at launch.

Common situations: Dev builds with stripped tauri.conf.json, renamed identifiers, running the packaged binary from services/sandboxes where the user profile is missing.

Related errors


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