{"record":{"id":"db81be1b022fcbc2","repo":"Zackriya-Solutions/meetily","slug":"could-not-find-system-data-directory-db81be","errorCode":null,"errorMessage":"Could not find system data directory","messagePattern":"Could not find system data directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/summary/summary_engine/model_manager.rs","lineNumber":147,"sourceCode":"\n    /// Create a new model manager with custom models directory\n    pub fn new_with_models_dir(models_dir: Option<PathBuf>) -> Result<Self> {\n        let models_dir = if let Some(dir) = models_dir {\n            dir\n        } else {\n            // Fallback: Use current directory in development\n            let current_dir = std::env::current_dir()\n                .map_err(|e| anyhow!(\"Failed to get current directory: {}\", e))?;\n\n            if cfg!(debug_assertions) {\n                // Development mode\n                current_dir.join(\"models\").join(\"summary\")\n            } else {\n                // Production mode fallback (caller should provide path)\n                log::warn!(\"ModelManager: No models directory provided, using fallback path\");\n                dirs::data_dir()\n                    .or_else(|| dirs::home_dir())\n                    .ok_or_else(|| anyhow!(\"Could not find system data directory\"))?\n                    .join(\"Meetily\")\n                    .join(\"models\")\n                    .join(\"summary\")\n            }\n        };\n\n        log::info!(\n            \"Built-in AI ModelManager using directory: {}\",\n            models_dir.display()\n        );\n\n        Ok(Self {\n            models_dir,\n            available_models: Arc::new(RwLock::new(HashMap::new())),\n            active_downloads: Arc::new(RwLock::new(HashSet::new())),\n            cancel_download_flag: Arc::new(RwLock::new(None)),\n        })\n    }","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/summary/summary_engine/model_manager.rs#L129-L165","documentation":"Production fallback when no models directory is provided: both dirs::data_dir() (XDG_DATA_HOME / APPDATA / ~/Library/Application Support) and dirs::home_dir() returned None, so there is nowhere to place models. The process environment lacks the platform's standard user/home variables.","triggerScenarios":"Running the binary as a systemd/Windows service without HOME or APPDATA set; minimal containers that drop environment variables; CI or test harnesses invoking the manager directly with a cleared environment.","commonSituations":"Windows service context missing %APPDATA%; Docker containers without HOME; test runners that scrub env.","solutions":["Always pass an explicit models directory via new_with_models_dir in production code paths","Set the missing variable for service contexts (HOME on Unix, APPDATA on Windows)","In containers, set HOME=/data or XDG_DATA_HOME=/data","Fail fast at app startup with a clear message instead of constructing the manager lazily"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Fail fast with a clear message when the environment is incomplete\nlet base = dirs::data_dir()\n    .or_else(dirs::home_dir)\n    .ok_or_else(|| anyhow!(\"No user data dir: set HOME (Unix) or APPDATA (Windows)\"))?;\nlet models_dir = base.join(\"Meetily\").join(\"models\").join(\"summary\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass an explicit models directory from the Tauri app path resolver instead of relying on env fallbacks","For services/containers, always set HOME or XDG_DATA_HOME / APPDATA","Validate the environment at startup rather than deep inside model construction"],"tags":["environment","missing-env-var","paths","rust"],"backgroundTag":"home-directory-not-found","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}