{"record":{"id":"6282392e5470d744","repo":"Zackriya-Solutions/meetily","slug":"could-not-find-config-directory","errorCode":null,"errorMessage":"Could not find config directory","messagePattern":"Could not find config directory","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/notifications/settings.rs","lineNumber":116,"sourceCode":"    #[allow(dead_code)] // Reserved for future functionality\n    app_handle: AppHandle<R>,\n    settings_path: PathBuf,\n}\n\nimpl<R: Runtime> ConsentManager<R> {\n    pub fn new(app_handle: AppHandle<R>) -> Result<Self> {\n        let settings_path = Self::get_settings_path()?;\n\n        Ok(Self {\n            app_handle,\n            settings_path,\n        })\n    }\n\n    /// Get the path where notification settings are stored\n    fn get_settings_path() -> Result<PathBuf> {\n        let mut path = dirs::config_dir()\n            .ok_or_else(|| anyhow!(\"Could not find config directory\"))?;\n\n        path.push(\"meetily\");\n        path.push(\"notifications.json\");\n\n        // Ensure parent directory exists\n        if let Some(parent) = path.parent() {\n            std::fs::create_dir_all(parent)?;\n        }\n\n        Ok(path)\n    }\n\n    /// Load notification settings from disk\n    pub async fn load_settings(&self) -> Result<NotificationSettings> {\n        if !self.settings_path.exists() {\n            log_info!(\"No notification settings file found, using defaults\");\n            return Ok(NotificationSettings::default());\n        }","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/notifications/settings.rs#L98-L134","documentation":"dirs::config_dir() returned None while resolving the path for notifications.json (config dir then meetily/notifications.json). The platform lookup for the user's config directory failed - on Linux that means no absolute XDG_CONFIG_HOME and no HOME; on macOS/Windows the home/profile directory is unavailable.","triggerScenarios":"Running the process with a stripped environment (systemd service, cron, launchd daemon without HOME), XDG_CONFIG_HOME set to a relative (invalid) path, or a Windows user profile that failed to load.","commonSituations":"App auto-started by a service manager that did not set HOME/XDG variables; CI or test harnesses with minimal environments.","solutions":["Run the app in a normal user session, or set HOME (and a valid XDG_CONFIG_HOME) in the service unit","Inside a Tauri app, prefer app.path().app_config_dir() over the dirs crate - it resolves via the app handle","Fail with an actionable message naming the missing environment variable"],"exampleFix":"// before\nlet mut path = dirs::config_dir()\n    .ok_or_else(|| anyhow!(\"Could not find config directory\"))?;\npath.push(\"meetily\");\npath.push(\"notifications.json\");\n\n// after - resolve through the Tauri app handle; resilient to env quirks\nfn get_settings_path<R: tauri::Runtime>(app: &tauri::AppHandle<R>) -> Result<PathBuf> {\n    let mut path = app.path().app_config_dir()\n        .map_err(|e| anyhow!(\"Could not resolve app config dir: {e}\"))?;\n    path.push(\"notifications.json\");\n    if let Some(parent) = path.parent() {\n        std::fs::create_dir_all(parent)?;\n    }\n    Ok(path)\n}","handlingStrategy":"validation","validationCode":"fn config_dir_resolvable() -> bool {\n    if cfg!(target_os = \"linux\") {\n        match std::env::var_os(\"XDG_CONFIG_HOME\") {\n            Some(v) if v.is_absolute() => true,\n            _ => std::env::var_os(\"HOME\").is_some(),\n        }\n    } else {\n        std::env::var_os(\"HOME\").is_some()\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Inside Tauri, use app.path().app_config_dir() instead of dirs::config_dir()","Set HOME and XDG_* variables in service/daemon launch units","Name the missing environment variable in the error message"],"tags":["dirs","filesystem","environment","config-path"],"backgroundTag":"home-directory-not-found","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}