Zackriya-Solutions/meetily · error
Failed to get current directory: {}
Error message
Failed to get current directory: {} What it means
std::env::current_dir() failed inside ModelManager's fallback when no models directory was supplied. On Unix this happens when the process's working directory was deleted after launch. It only matters in debug builds (dev path is cwd/models/summary); production callers are expected to always pass an explicit directory.
Source
Thrown at frontend/src-tauri/src/summary/summary_engine/model_manager.rs:137
/// Cancellation flag for current download
cancel_download_flag: Arc<RwLock<Option<String>>>,
}
impl ModelManager {
/// Create a new model manager with default models directory
pub fn new() -> Result<Self> {
Self::new_with_models_dir(None)
}
/// Create a new model manager with custom models directory
pub fn new_with_models_dir(models_dir: Option<PathBuf>) -> Result<Self> {
let models_dir = if let Some(dir) = models_dir {
dir
} else {
// Fallback: Use current directory in development
let current_dir = std::env::current_dir()
.map_err(|e| anyhow!("Failed to get current directory: {}", e))?;
if cfg!(debug_assertions) {
// Development mode
current_dir.join("models").join("summary")
} else {
// Production mode fallback (caller should provide path)
log::warn!("ModelManager: No models directory provided, using fallback path");
dirs::data_dir()
.or_else(|| dirs::home_dir())
.ok_or_else(|| anyhow!("Could not find system data directory"))?
.join("Meetily")
.join("models")
.join("summary")
}
};
log::info!(
"Built-in AI ModelManager using directory: {}",View on GitHub (pinned to 0281737d87)
Solutions
- Pass an explicit models directory with new_with_models_dir(Some(...)) at every call site
- If implicit resolution is required, fall back to std::env::current_exe()'s parent instead of cwd
- In dev, restart the app from an existing directory; avoid deleting the launch directory while it runs
Example fix
// before
let manager = ModelManager::new()?;
// after: always anchor to app data, never cwd
let models_dir = app_data_dir.join("models").join("summary");
let manager = ModelManager::new_with_models_dir(Some(models_dir))?; Defensive patterns
Strategy: validation
Validate before calling
// Never rely on cwd: resolve the models dir from app data up front
let models_dir = app_data_dir.join("models").join("summary");
tokio::fs::create_dir_all(&models_dir).await?;
let manager = ModelManager::new_with_models_dir(Some(models_dir))?; Prevention
- Always pass an explicit directory to new_with_models_dir in app code
- In dev, launch the app from a stable directory and avoid clean scripts that delete it mid-run
- Prefer std::env::current_exe().parent() over cwd for any implicit path
When it happens
Trigger: Constructing ModelManager::new() (no dir passed) after the directory the app was launched from was deleted; running tauri:dev while a build/clean script removes and recreates the project directory; a wrapper script that cd's into a temp dir it later deletes.
Common situations: Dev workflows where clean_run.sh or a build step recreates the working directory while the app runs; launching from a deleted temp/snapshot directory on macOS.
Related errors
- Failed to get current directory: {}
- Could not find config directory
- Failed to create file {}: {}
- Failed to write chunk to file: {}
- Failed to flush file {}: {}
AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16).
Data as JSON: /api/errors/ef4c43f598c4438c.
Report an issue: GitHub.