Zackriya-Solutions/meetily · error
Failed to create file {}: {}
Error message
Failed to create file {}: {} What it means
Thrown when the Parakeet engine cannot create the destination file for a fresh model download: tokio's fs::File::create returned an io::Error before any bytes were written. The first placeholder is the target filename, the second is the underlying OS error. It is always a filesystem problem (path, permissions, disk), never a network one.
Source
Thrown at frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs:818
}
} else {
// Other errors
let mut active = self.active_downloads.write().await;
active.remove(model_name);
return Err(anyhow!("Download failed for {} with status: {}", filename, response.status()));
};
// Open file for writing (append if resuming, create new if not)
let file = if resuming {
fs::OpenOptions::new()
.append(true)
.open(&file_path)
.await
.map_err(|e| anyhow!("Failed to open file for resume {}: {}", filename, e))?
} else {
fs::File::create(&file_path)
.await
.map_err(|e| anyhow!("Failed to create file {}: {}", filename, e))?
};
// Use buffered writer for better I/O performance (8MB buffer)
let mut writer = BufWriter::with_capacity(8 * 1024 * 1024, file);
// Stream download
use futures_util::StreamExt;
let mut stream = response.bytes_stream();
let mut file_downloaded = if resuming { existing_size } else { 0u64 };
loop {
// Check for cancellation before processing chunk
{
let cancel_flag = self.cancel_download_flag.read().await;
if cancel_flag.as_ref() == Some(&model_name.to_string()) {
log::info!("Download cancelled for {}", model_name);
// Flush and keep partial file for resume on next attempt
let _ = writer.flush().await;View on GitHub (pinned to 0281737d87)
Solutions
- Create the parent directory first: tokio::fs::create_dir_all on file_path.parent() before File::create
- Verify the process has write permission on the models directory and the volume has free space larger than the model file
- On Windows, exclude the app's models directory from real-time antivirus scanning
- Surface the io::ErrorKind (PermissionDenied / StorageFull) in the UI so users can tell permissions from disk space
Example fix
// before
let file = fs::File::create(&file_path)
.await
.map_err(|e| anyhow!("Failed to create file {}: {}", filename, e))?;
// after
if let Some(parent) = file_path.parent() {
tokio::fs::create_dir_all(parent)
.await
.map_err(|e| anyhow!("Failed to create models dir {}: {}", parent.display(), e))?;
}
let file = fs::File::create(&file_path)
.await
.map_err(|e| anyhow!("Failed to create file {}: {}", filename, e))? Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight before starting a parakeet model download
let dir = file_path.parent().unwrap();
tokio::fs::create_dir_all(dir).await?;
let probe = dir.join(".write_probe");
tokio::fs::write(&probe, b"x").await?; // fails fast on permissions
tokio::fs::remove_file(&probe).await?; Try / catch
match download_result {
Err(e) if e.to_string().starts_with("Failed to create file") => {
// filesystem-level: check dir exists, permissions, free space; do NOT retry blindly
show_fix_storage_dialog();
}
other => other,
} Prevention
- Create the models directory with create_dir_all at app startup, not lazily at download time
- Check available disk space against the model's total size before invoking download
- Exclude the app's models directory from antivirus and cloud-sync tools
When it happens
Trigger: Starting a parakeet model download with no existing partial file while the models directory does not exist, is read-only, or is not writable by the process; the target volume is full; or antivirus/another process locks the new file at creation time.
Common situations: App data directory never created with create_dir_all before the first download; running in dev mode from a read-only checkout; disk exhausted by a previous multi-GB model; Windows Defender or a sync client holding a lock on the target path.
Related errors
- Failed to create file: {}
- Failed to flush file: {}
- Failed to write chunk to file: {}
- Failed to flush file {}: {}
- Failed to open file for append: {}
AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16).
Data as JSON: /api/errors/ab9e65906e212f98.
Report an issue: GitHub.