Zackriya-Solutions/meetily · error
Failed to flush file: {}
Error message
Failed to flush file: {} What it means
After the stream completes, the final file.flush() failed; the OS error is appended. This usually means buffered data could not be committed to disk — ENOSPC at close time (space calculations during streaming were optimistic because writes were buffered) or an I/O error from a failing device. The file can be incomplete even though every chunk write 'succeeded'.
Source
Thrown at frontend/src-tauri/src/whisper_engine/whisper_engine.rs:1077
}
}
log::info!("Streaming download completed: {} bytes", downloaded);
// Ensure 100% progress is always reported
{
let mut models = self.available_models.write().await;
if let Some(model_info) = models.get_mut(model_name) {
model_info.status = ModelStatus::Downloading { progress: 100 };
}
}
if let Some(ref callback) = progress_callback {
callback(100);
}
file.flush().await
.map_err(|e| anyhow!("Failed to flush file: {}", e))?;
log::info!("Download completed for model: {}", model_name);
// Update model status to available
{
let mut models = self.available_models.write().await;
if let Some(model_info) = models.get_mut(model_name) {
model_info.status = ModelStatus::Available;
model_info.path = file_path.clone();
}
}
// Remove from active downloads on completion
{
let mut active = self.active_downloads.write().await;
active.remove(model_name);
}
View on GitHub (pinned to 0281737d87)
Solutions
- Free disk space beyond the model size (leave a healthy margin for OS buffers) and re-download
- Run a disk health check if flush errors repeat on the same device
- Verify the resulting file size matches the expected size before loading; a short file will otherwise surface later as Corrupted
Defensive patterns
Strategy: validation
Validate before calling
// Rust: after download, verify size before trusting the file
let meta = fs::metadata(&file_path).await?;
if meta.len() + 50 * 1024 * 1024 > fs2::available_space(&self.models_dir)? {
return Err(anyhow!("Margin too thin for flush; free space"));
} Try / catch
try {
await invoke('download_model', { modelName });
} catch (e) {
if (String(e).includes('Failed to flush file')) {
await cleanupPartial(modelName);
await invoke('download_model', { modelName }); // retry after freeing space
} else { throw e; }
} Prevention
- Require free space of model size plus a buffer (OS write-behind makes streaming counts optimistic)
- Treat flush failures at end-of-download as disk-health warnings if they recur
- Validate the final file size against the expected size before marking the model Available
When it happens
Trigger: Disk fills exactly as the last buffers flush at close; USB/external drive errors or forced unmount at the end of a large write; filesystem corruption.
Common situations: Free space just barely above the model size; flaky external storage; large-v3 downloads on nearly-full disks.
Related errors
- Failed to create file {}: {}
- Failed to create file: {}
- Failed to create file: {}
- Failed to write chunk to file: {}
- Failed to create model directory: {}
AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16).
Data as JSON: /api/errors/c34609c3099cb3ad.
Report an issue: GitHub.