{"record":{"id":"35eb54fd7848e826","repo":"Zackriya-Solutions/meetily","slug":"failed-to-flush-file","errorCode":null,"errorMessage":"Failed to flush file {}: {}","messagePattern":"Failed to flush file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":1000,"sourceCode":"            }\n\n            // Flush the buffered writer\n            if let Err(e) = writer.flush().await {\n                // Remove from active downloads on error\n                {\n                    let mut active = self.active_downloads.write().await;\n                    active.remove(model_name);\n                }\n\n                // Update model status to Missing so retry can work\n                {\n                    let mut models = self.available_models.write().await;\n                    if let Some(model) = models.get_mut(model_name) {\n                        model.status = ModelStatus::Missing;\n                    }\n                }\n\n                return Err(anyhow!(\"Failed to flush file {}: {}\", filename, e));\n            }\n\n            log::info!(\n                \"Completed download: {} ({:.2} MB, overall progress: {:.1}%)\",\n                filename,\n                file_downloaded as f64 / 1_048_576.0,\n                (total_downloaded as f64 / total_size_bytes as f64) * 100.0\n            );\n        }\n\n        // Report 100% progress with final speed\n        let total_elapsed = download_start_time.elapsed().as_secs_f64();\n        let final_speed = if total_elapsed > 0.0 {\n            ((total_downloaded - already_downloaded) as f64 / (1024.0 * 1024.0)) / total_elapsed\n        } else {\n            0.0\n        };\n        let final_progress = DownloadProgress::new(total_size_bytes, total_size_bytes, final_speed);","sourceCodeStart":982,"sourceCodeEnd":1018,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L982-L1018","documentation":"After the stream ends, the engine flushes the 8 MB BufWriter; if that final flush fails this error is raised and the download is treated as failed even though all bytes were received. The model status resets to Missing so the retry path works.","triggerScenarios":"Disk fills exactly as the last buffered bytes are flushed; the target file is deleted or its permissions change during the download; removable storage ejected before completion; OS write-cache failure.","commonSituations":"Earlier chunks consumed the remaining space so the final 8 MB flush fails; antivirus quarantining the file at completion; user unmounting an external models drive mid-download.","solutions":["Free disk space and retry — the partial file resumes from its flushed offset","Exclude the models directory from sync/antivirus tools and retry","If the models dir lives on external storage, verify it is still mounted before retrying","Flush periodically or shrink the buffer so failures surface earlier with less data at risk"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().starts_with(\"Failed to flush file\") => {\n        // All bytes arrived but the last buffer write failed: check disk space/AV, then retry (resumes)\n        check_free_space(); retry_download_with_resume()\n    }\n    other => other,\n}","preventionTips":["Leave headroom on the volume well above the model size (buffers flush at completion)","Flush periodically during long downloads so failures surface early","Exclude the models directory from antivirus quarantine on completion"],"tags":["filesystem","disk-full","io","rust"],"backgroundTag":"disk-write-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}