Zackriya-Solutions/meetily · error · anyhow::Error
Failed to get current directory: {}
Error message
Failed to get current directory: {} What it means
When no models_dir is supplied, WhisperEngine::new falls back to std::env::current_dir() to probe development model directories. The OS call failed - on Unix this almost always means the process's working directory was deleted while the process was still running.
Source
Thrown at frontend/src-tauri/src/whisper_engine/whisper_engine.rs:98
Self::new_with_models_dir(None)
}
/// Create a new WhisperEngine with optional custom models directory
/// If models_dir is None, uses default location (app data dir for production, local for dev)
pub fn new_with_models_dir(models_dir: Option<PathBuf>) -> Result<Self> {
// PERFORMANCE: Suppress verbose whisper.cpp and Metal logs
// These C library logs bypass Rust logging and clutter output
// Set environment variables to reduce C library verbosity
std::env::set_var("GGML_METAL_LOG_LEVEL", "1"); // 0=off, 1=error, 2=warn, 3=info
std::env::set_var("WHISPER_LOG_LEVEL", "1"); // Reduce whisper.cpp verbosity
let models_dir = if let Some(dir) = models_dir {
// Use provided directory (for production with app_data_dir)
dir
} else {
// Fallback: determine based on debug/release mode
let current_dir = std::env::current_dir()
.map_err(|e| anyhow!("Failed to get current directory: {}", e))?;
// Development: Use frontend/models or backend directories
// Production: Use system directories (should be overridden by caller)
if cfg!(debug_assertions) {
// Development mode - try frontend and backend directories
if current_dir.join("models").exists() {
current_dir.join("models")
} else if current_dir.join("../models").exists() {
current_dir.join("../models")
} else if current_dir.join("backend/whisper-server-package/models").exists() {
current_dir.join("backend/whisper-server-package/models")
} else if current_dir.join("../backend/whisper-server-package/models").exists() {
current_dir.join("../backend/whisper-server-package/models")
} else {
// Create models directory in current directory for development
current_dir.join("models")
}
} else {View on GitHub (pinned to 0281737d87)
Solutions
- Pass an explicit models_dir when constructing WhisperEngine - production code should never rely on the cwd fallback
- Restart the app from a directory that currently exists
- Avoid deleting/recreating the working directory while the dev server or app process is running
Defensive patterns
Strategy: validation
Validate before calling
// Never rely on the cwd fallback in app code
let models_dir = app.path().app_data_dir()?.join("models");
let engine = WhisperEngine::new(Some(models_dir)).await?; Prevention
- Always pass an explicit models_dir (Tauri app_data_dir) when constructing WhisperEngine
- Do not delete/recreate the directory a dev process was launched from while it runs
- If hit in dev, restarting the app from an existing directory resolves it
When it happens
Trigger: Constructing WhisperEngine without an explicit models_dir while the cwd has been removed: running the dev binary from a directory that a clean/rebuild script deleted and recreated, or launching from a temp or unmounted path.
Common situations: Running cargo tauri dev after clean_run.sh removed directories out from under the shell; launching the binary from a removable/unmounted drive; sandboxed environments that restrict getcwd.
Related errors
- Could not find config directory
- Failed to get current directory: {}
- Failed to get current directory: {}
- Could not find system data directory
- Model {} is corrupted and cannot be loaded
AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16).
Data as JSON: /api/errors/55f6128bd99fda4d.
Report an issue: GitHub.