Zackriya-Solutions/meetily · error · anyhow::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'.
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
- Failed to write chunk to file
AI-assisted analysis of Zackriya-Solutions/meetily@a2cb62e827 (2026-09-12).
Data as JSON: /api/errors/c34609c3099cb3ad.
Report an issue: GitHub.
Appendix: source
Thrown at frontend/src-tauri/src/whisper_engine/whisper_engine.rs:1229
last_progress_report = progress;
last_report_time = std::time::Instant::now();
}
}
{
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))?;
if active_download.cancellation.is_cancelled() {
return Err(DownloadCancelled.into());
}
Ok(())
}
pub async fn cancel_download(&self, model_name: &str) -> Result<CancelDownloadOutcome> {
self.cancel_download_with_timeout(model_name, CANCEL_DOWNLOAD_CLEANUP_TIMEOUT)
.await
}
async fn cancel_download_with_timeout(
&self,
model_name: &str,
cleanup_timeout: Duration,View on GitHub (pinned to a2cb62e827)