Zackriya-Solutions/meetily · error · anyhow::Error
Failed to get current directory: {}
Error message
Failed to get current directory: {} What it means
std::env::current_dir() failed while resolving the development-mode models directory (cwd/models/parakeet) in ParakeetEngine::new_with_models_dir. getcwd fails when the process's working directory has been deleted or is no longer readable - the OS cannot report it.
Source
Thrown at frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs:132
pub struct ParakeetEngine {
models_dir: PathBuf,
current_model: Arc<RwLock<Option<ParakeetModel>>>,
current_model_name: Arc<RwLock<Option<String>>>,
pub(crate) available_models: Arc<RwLock<HashMap<String, ModelInfo>>>,
cancel_download_flag: Arc<RwLock<Option<String>>>, // Model name being cancelled
// Active downloads tracking to prevent concurrent downloads
pub(crate) active_downloads: Arc<RwLock<HashSet<String>>>, // Set of models currently being downloaded
}
impl ParakeetEngine {
/// Create a new Parakeet engine with optional 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.join("parakeet") // Parakeet models in subdirectory
} else {
// Fallback to default location
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("parakeet")
} else {
// Production mode
dirs::data_dir()
.or_else(|| dirs::home_dir())
.ok_or_else(|| anyhow!("Could not find system data directory"))?
.join("Meetily")
.join("models")
.join("parakeet")
}
};
log::info!("ParakeetEngine using models directory: {}", models_dir.display());
// Create directory if it doesn't existView on GitHub (pinned to 0281737d87)
Solutions
- Relaunch the dev build from an existing directory
- Pass an explicit models_dir (from Tauri's app_data_dir) so the engine never depends on cwd
- Anchor the dev path on the executable or manifest dir instead of current_dir()
Example fix
// before
let current_dir = std::env::current_dir()
.map_err(|e| anyhow!("Failed to get current directory: {e}"))?;
current_dir.join("models").join("parakeet")
// after - anchor on the executable; immune to deleted/changed cwd
let base = std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(Path::to_path_buf))
.ok_or_else(|| anyhow!("Could not resolve executable directory"))?;
base.join("models").join("parakeet") Defensive patterns
Strategy: validation
Validate before calling
// Never depend on cwd: resolve the models dir from the app handle
let models_dir = app.path().app_data_dir()
.map_err(|e| anyhow!("app data dir: {e}"))?
.join("models");
let engine = ParakeetEngine::new_with_models_dir(Some(models_dir))?; Prevention
- Pass an explicit models_dir in all builds
- If a filesystem-relative anchor is required, use current_exe() instead of current_dir()
- Restart dev runs from an existing checkout directory
When it happens
Trigger: Launching a debug build from a directory that is later deleted (temp dirs, some script launchers), or running under a service whose cwd no longer exists at the time the engine is constructed.
Common situations: cargo run from a since-removed checkout path; tooling that cds into a temp dir and removes it; long-lived dev processes after a clean script wiped the folder.
Related errors
- Could not find system data directory
- Failed to get current directory: {}
- Could not find config directory
- Model {} not found
- Failed to delete directory '{}': {}
AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16).
Data as JSON: /api/errors/7488b899c104dad5.
Report an issue: GitHub.