{"record":{"id":"c34609c3099cb3ad","repo":"Zackriya-Solutions/meetily","slug":"failed-to-flush-file-c34609","errorCode":null,"errorMessage":"Failed to flush file: {}","messagePattern":"Failed to flush file: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/whisper_engine/whisper_engine.rs","lineNumber":1229,"sourceCode":"                last_progress_report = progress;\n                last_report_time = std::time::Instant::now();\n            }\n        }\n\n        {\n            let mut models = self.available_models.write().await;\n            if let Some(model_info) = models.get_mut(model_name) {\n                model_info.status = ModelStatus::Downloading { progress: 100 };\n            }\n        }\n\n        if let Some(ref callback) = progress_callback {\n            callback(100);\n        }\n\n        file.flush()\n            .await\n            .map_err(|e| anyhow!(\"Failed to flush file: {}\", e))?;\n\n        if active_download.cancellation.is_cancelled() {\n            return Err(DownloadCancelled.into());\n        }\n\n\n        Ok(())\n    }\n\n    pub async fn cancel_download(&self, model_name: &str) -> Result<CancelDownloadOutcome> {\n        self.cancel_download_with_timeout(model_name, CANCEL_DOWNLOAD_CLEANUP_TIMEOUT)\n            .await\n    }\n\n    async fn cancel_download_with_timeout(\n        &self,\n        model_name: &str,\n        cleanup_timeout: Duration,","sourceCodeStart":1211,"sourceCodeEnd":1247,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/a2cb62e827da7ef59f65064c97233efb2313878e/frontend/src-tauri/src/whisper_engine/whisper_engine.rs#L1211-L1247","documentation":"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'.","triggerScenarios":"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.","commonSituations":"Free space just barely above the model size; flaky external storage; large-v3 downloads on nearly-full disks.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Rust: after download, verify size before trusting the file\nlet meta = fs::metadata(&file_path).await?;\nif meta.len() + 50 * 1024 * 1024 > fs2::available_space(&self.models_dir)? {\n    return Err(anyhow!(\"Margin too thin for flush; free space\"));\n}","typeGuard":null,"tryCatchPattern":"try {\n  await invoke('download_model', { modelName });\n} catch (e) {\n  if (String(e).includes('Failed to flush file')) {\n    await cleanupPartial(modelName);\n    await invoke('download_model', { modelName }); // retry after freeing space\n  } else { throw e; }\n}","preventionTips":["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"],"tags":["filesystem","disk-space","download","io","rust"],"backgroundTag":"out-of-disk-space","analyzedSha":"a2cb62e827da7ef59f65064c97233efb2313878e","analyzedAt":"2026-09-12T11:12:14.152Z","contentChangedAt":"2026-09-12T11:12:14.152Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}