{"record":{"id":"dbbb09a676a51d0a","repo":"Zackriya-Solutions/meetily","slug":"file-validation-failed","errorCode":null,"errorMessage":"File validation failed: {}","messagePattern":"File validation failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/summary/summary_engine/model_manager.rs","lineNumber":751,"sourceCode":"        if let Err(e) = self.validate_gguf_file(&file_path).await {\n            log::error!(\"Downloaded file failed validation: {}\", e);\n\n            // Clean up invalid file\n            let _ = fs::remove_file(&file_path).await;\n\n            // Update status\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::Error(format!(\"Validation failed: {}\", e));\n                }\n            }\n\n            // Remove from active downloads\n            let mut active = self.active_downloads.write().await;\n            active.remove(model_name);\n\n            return Err(anyhow!(\"File validation failed: {}\", e));\n        }\n\n        // Update status to available\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::Available;\n                model_info.path = file_path.clone();\n            }\n        }\n\n        // Remove from active downloads\n        {\n            let mut active = self.active_downloads.write().await;\n            active.remove(model_name);\n        }\n\n        Ok(())","sourceCodeStart":733,"sourceCodeEnd":769,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/summary/summary_engine/model_manager.rs#L733-L769","documentation":"After the download stream completes, ModelManager runs validate_model_file on the result; this error wraps any validation failure. It means bytes were received until the stream ended, but the resulting file is not a usable model - usually a truncated body that ended 'cleanly' or content that is not a GGUF at all.","triggerScenarios":"download_model finishes the stream but the file fails the post-download check (typically the magic-number check). The manager sets ModelStatus::Error('Validation failed: ...'), removes the model from active_downloads, and returns this error.","commonSituations":"Server/proxy closing the connection early without a stream error so the tail of the file is missing, disk filling near the end of the download so final bytes were lost, resuming a partial file whose bytes no longer match the current response body.","solutions":["Retry the download - status is Error so the UI retry button appears","Delete the corrupted partial file (delete_model) first so the retry starts from byte zero","Verify disk space and network stability before retrying","If it persists, download the GGUF manually into app_data/models/summary/<gguf_file> with the exact expected filename, then refresh models"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// After download completes (caller-side sanity): size must match Content-Length\nlet meta = std::fs::metadata(&file_path)?;\nif expected_size > 0 && meta.len() != expected_size {\n    std::fs::remove_file(&file_path)?; // drop truncated file\n    return Err(anyhow!(\"truncated download: {} != {}\", meta.len(), expected_size));\n}","typeGuard":null,"tryCatchPattern":"try { manager.download_model(name).await? }\ncatch (e) if e.to_string().contains(\"File validation failed\") {\n    manager.delete_model(name).await.ok();       // remove corrupt file\n    manager.download_model(name).await?;          // fresh retry\n}","preventionTips":["Treat validation failure as a corrupt artifact: always delete before retrying","Compare downloaded size to Content-Length as a cheap truncation check","Keep per-download retry counters bounded to avoid loops on a persistently bad network"],"tags":["download","validation","model-manager","gguf"],"backgroundTag":"file-validation-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}