{"record":{"id":"e385ac2d41d79747","repo":"Zackriya-Solutions/meetily","slug":"failed-to-get-app-data-dir-e385ac","errorCode":null,"errorMessage":"Failed to get app data dir","messagePattern":"Failed to get app data dir","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"frontend/src-tauri/src/parakeet_engine/commands.rs","lineNumber":17,"sourceCode":"use crate::parakeet_engine::{ModelInfo, ModelStatus, ParakeetEngine, DownloadProgress};\nuse std::path::PathBuf;\nuse std::sync::Mutex;\nuse std::sync::Arc;\nuse tauri::{command, Emitter, AppHandle, Manager, Runtime};\n\n// Global parakeet engine\npub static PARAKEET_ENGINE: Mutex<Option<Arc<ParakeetEngine>>> = Mutex::new(None);\n\n// Global models directory path (set during app initialization)\nstatic MODELS_DIR: Mutex<Option<PathBuf>> = Mutex::new(None);\n\n/// Initialize the models directory path using app_data_dir\n/// This should be called during app setup before parakeet_init\npub fn set_models_directory<R: Runtime>(app: &AppHandle<R>) {\n    let app_data_dir = app.path().app_data_dir()\n        .expect(\"Failed to get app data dir\");\n\n    let models_dir = app_data_dir.join(\"models\");\n\n    // Create directory if it doesn't exist\n    if !models_dir.exists() {\n        if let Err(e) = std::fs::create_dir_all(&models_dir) {\n            log::error!(\"Failed to create models directory: {}\", e);\n            return;\n        }\n    }\n\n    log::info!(\"Parakeet models directory set to: {}\", models_dir.display());\n\n    let mut guard = MODELS_DIR.lock().unwrap();\n    *guard = Some(models_dir);\n}\n\n/// Get the configured models directory","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/parakeet_engine/commands.rs#L1-L35","documentation":"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.","triggerScenarios":"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.","commonSituations":"Dev builds with stripped tauri.conf.json, renamed identifiers, running the packaged binary from services/sandboxes where the user profile is missing.","solutions":["Set a valid `identifier` in tauri.conf.json (reverse-DNS, no underscores) — fixes every app_data_dir site","Return early with a logged error instead of expect: log::error and skip engine init, letting the UI show 'models unavailable'","Ensure the environment provides a home directory when running headless","Rebuild so generate_context! embeds the corrected identifier"],"exampleFix":"// before\nlet app_data_dir = app.path().app_data_dir()\n    .expect(\"Failed to get app data dir\");\n\n// after\nlet Ok(app_data_dir) = app.path().app_data_dir() else {\n    log::error!(\"app_data_dir unresolved; parakeet models disabled\");\n    return;\n};","handlingStrategy":"validation","validationCode":"if app.path().app_data_dir().is_err() {\n    log::error!(\"app_data_dir unresolved; parakeet disabled this session\");\n    return; // skip engine init instead of crashing setup\n}","typeGuard":null,"tryCatchPattern":"let Ok(app_data_dir) = app.path().app_data_dir() else {\n    log::error!(\"app_data_dir unresolved; parakeet models disabled\");\n    return;\n};","preventionTips":["Set a valid reverse-DNS identifier in tauri.conf.json before adding any path-dependent subsystem","Make set_models_directory fallible or early-return; setup hooks must not panic on environment problems","Test app startup in HOME-less environments when shipping to kiosks/services"],"tags":["rust","tauri","app-data-dir","parakeet","startup"],"backgroundTag":"tauri-app-data-dir-unresolved","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}