{"record":{"id":"cca9a2ad344e05c2","repo":"Zackriya-Solutions/meetily","slug":"failed-to-get-app-data-dir","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/database/manager.rs","lineNumber":49,"sourceCode":"        }\n\n        let pool = SqlitePool::connect(tauri_db_path).await?;\n\n        sqlx::migrate!(\"./migrations\").run(&pool).await?;\n\n        Ok(DatabaseManager { pool })\n    }\n\n    // NOTE: So for the first time users they needs to start the application\n    // after they can just delete the existing .sqlite file and then copy the existing .db file to\n    // the current app dir, So the system detects legacy db and copy it and starts with that data\n    // (Newly created .sqlite with the copied content from .db)\n    pub async fn new_from_app_handle(app_handle: &tauri::AppHandle) -> Result<Self> {\n        // Resolve the app's data directory\n        let app_data_dir = app_handle\n            .path()\n            .app_data_dir()\n            .expect(\"failed to get app data dir\");\n        if !app_data_dir.exists() {\n            fs::create_dir_all(&app_data_dir).map_err(|e| sqlx::Error::Io(e))?;\n        }\n\n        // Define database paths\n        let tauri_db_path = app_data_dir\n            .join(\"meeting_minutes.sqlite\")\n            .to_string_lossy()\n            .to_string();\n        // Legacy backend DB path (for auto-migration if exists)\n        let backend_db_path = app_data_dir\n            .join(\"meeting_minutes.db\")\n            .to_string_lossy()\n            .to_string();\n\n        // WAL file paths for defensive cleanup\n        let wal_path = app_data_dir.join(\"meeting_minutes.sqlite-wal\");\n        let shm_path = app_data_dir.join(\"meeting_minutes.sqlite-shm\");","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/database/manager.rs#L31-L67","documentation":"Tauri 2's path().app_data_dir() returns Result<PathBuf, tauri::Error>; it errors when the app identifier is missing/invalid (the data dir is derived from it) or the platform base directory cannot be resolved (e.g. no HOME on Linux). The .expect panics DatabaseManager creation during startup, aborting launch.","triggerScenarios":"tauri.conf.json has no valid `identifier` (unset, default placeholder, or contains invalid characters like underscores), or the process runs in an environment without a home/profile directory (system services, minimal CI containers).","commonSituations":"Developers stripping down tauri.conf.json, copying config templates that omit the identifier, running the built binary from a systemd service or CI sandbox where HOME is unset, renaming the bundle identifier with characters Tauri rejects.","solutions":["Set a valid identifier in tauri.conf.json, e.g. \"identifier\": \"com.meetily.app\" (letters, digits, hyphens, dots only — no underscores)","Replace .expect with proper ? propagation and show the underlying tauri::Error in a startup dialog","Ensure the process has a resolvable home dir (export HOME on Linux service/CI runs)","After fixing config, rebuild so tauri's generate_context! re-embeds the corrected identifier"],"exampleFix":"// before\nlet app_data_dir = app_handle.path().app_data_dir()\n    .expect(\"failed to get app data dir\");\n\n// after\nlet app_data_dir = app_handle.path().app_data_dir()\n    .map_err(|e| anyhow::anyhow!(\"app_data_dir unresolved: {e}\"))?;","handlingStrategy":"validation","validationCode":"// before app start, confirm the identifier resolves\nlet dir = app.path().app_data_dir();\nif dir.is_err() {\n    eprintln!(\"tauri.conf.json: set a valid `identifier` (e.g. com.meetily.app)\");\n}","typeGuard":null,"tryCatchPattern":"let app_data_dir = app_handle\n    .path()\n    .app_data_dir()\n    .map_err(|e| anyhow::anyhow!(\"app_data_dir unresolved: {e}\"))?;","preventionTips":["Always set a reverse-DNS identifier in tauri.conf.json; never ship the default/empty value","Validate identifier charset: letters, digits, hyphens, dots only","Run packaged binaries from a user session (HOME set), and test service launches explicitly"],"tags":["rust","tauri","app-data-dir","configuration","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"}