{"record":{"id":"f0bcb93618290303","repo":"Zackriya-Solutions/meetily","slug":"failed-to-get-app-data-dir-f0bcb9","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/whisper_engine/commands.rs","lineNumber":17,"sourceCode":"use crate::whisper_engine::{ModelInfo, WhisperEngine};\nuse std::sync::{Arc, Mutex};\nuse std::path::PathBuf;\nuse tauri::{command, Emitter, Manager, AppHandle, Runtime};\nuse crate::config::WHISPER_MODEL_CATALOG;\n\n// Global whisper engine\npub static WHISPER_ENGINE: Mutex<Option<Arc<WhisperEngine>>> = 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 whisper_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!(\"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/whisper_engine/commands.rs#L1-L35","documentation":"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.","triggerScenarios":"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.","commonSituations":"Dev configs with a stripped tauri.conf.json, identifier renames, packaged binaries launched from services or CI sandboxes without a user profile.","solutions":["Set a valid `identifier` in tauri.conf.json — one fix covers all app_data_dir expects in the app","Replace expect with a logged early-return so a missing dir disables Whisper with a UI message instead of crashing","Verify HOME/known-folder resolution in the launch environment (print app.path().app_data_dir() in debug builds)","Rebuild after the config change so the identifier is re-embedded"],"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; whisper models disabled\");\n    return;\n};","handlingStrategy":"validation","validationCode":"if app.path().app_data_dir().is_err() {\n    log::error!(\"app_data_dir unresolved; whisper disabled this session\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"let Ok(app_data_dir) = app.path().app_data_dir() else {\n    log::error!(\"app_data_dir unresolved; whisper models disabled\");\n    return;\n};","preventionTips":["Fix the tauri.conf.json identifier once; it removes this entire error class across the app","Make setup-path hooks non-panicking: log and disable the subsystem instead","Smoke-test app_data_dir resolution in a startup self-check that reports to logs/UI"],"tags":["rust","tauri","app-data-dir","whisper","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"}