{"record":{"id":"b36b7910b0ad6edc","repo":"Zackriya-Solutions/meetily","slug":"downloaded-model-file-is-too-small-bytes-expected-at-least","errorCode":null,"errorMessage":"Downloaded model file is too small: {} bytes (expected at least {} bytes)","messagePattern":"Downloaded model file is too small: (.+?) bytes \\(expected at least (.+?) bytes\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/whisper_engine/whisper_engine.rs","lineNumber":980,"sourceCode":"        if !active_owner_matches {\n            log::warn!(\"Download owner for {} was no longer active during finalization\", model_name);\n            active_download.completion.send_replace(true);\n            return result;\n        }\n\n        if result.is_ok() && !active_download.cancellation.is_cancelled() {\n            result = self.validate_model_file(file_path).await;\n\n            if result.is_ok() {\n                let expected_min_size = WHISPER_MODEL_CATALOG\n                    .iter()\n                    .find(|model| model.0 == model_name)\n                    .map(|model| ((model.2 as f64 * 0.9) as u64) * 1024 * 1024);\n\n                result = match expected_min_size {\n                    Some(expected_min_size) => match fs::metadata(file_path).await {\n                        Ok(metadata) if metadata.len() >= expected_min_size => Ok(()),\n                        Ok(metadata) => Err(anyhow!(\n                            \"Downloaded model file is too small: {} bytes (expected at least {} bytes)\",\n                            metadata.len(),\n                            expected_min_size\n                        )),\n                        Err(e) => Err(anyhow!(\n                            \"Failed to read downloaded model file metadata: {}\",\n                            e\n                        )),\n                    },\n                    None => Err(anyhow!(\n                        \"Unsupported model for download validation: {}\",\n                        model_name\n                    )),\n                };\n            }\n        }\n\n        if result.is_err() && !active_download.cancellation.is_cancelled() && file_path.exists() {","sourceCodeStart":962,"sourceCodeEnd":998,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/a2cb62e827da7ef59f65064c97233efb2313878e/frontend/src-tauri/src/whisper_engine/whisper_engine.rs#L962-L998","documentation":"After a Whisper model download, the engine estimates a minimum plausible size (90% of the model's known size in MB, converted to bytes) and checks the downloaded file's metadata against it. If the file is smaller than that floor, it fails with this message because the file is almost certainly truncated or corrupt rather than a valid model.","triggerScenarios":"Raised in finish_download (called from download_model_from_url) when fs::metadata(file_path).len() < expected_min_size, where expected_min_size = 0.9 * known model size in MB * 1024 * 1024 — i.e., the downloaded file is under 90% of the expected model size.","commonSituations":"Network drop mid-download leaving a truncated file that the HTTP layer treated as complete; disk-full silently shortening the write; a server/proxy returning a partial body or an error page far smaller than the model; pausing/resuming downloads with a client that doesn't support range requests.","solutions":["Delete the truncated model file and re-run the download on a stable connection.","Check free disk space in the models directory; free space if low and retry.","Bypass proxies/VPNs or retry from a different network to rule out content filtering truncating the transfer.","If it recurs for one model, verify the server-side file size matches the known model size and update the model registry entry."],"exampleFix":"// before\nresult = match fs::metadata(file_path).await {\n    Ok(metadata) if metadata.len() >= expected_min_size => Ok(()),\n    Ok(metadata) => Err(anyhow!(\"Downloaded model file is too small: {} bytes (expected at least {} bytes)\", metadata.len(), expected_min_size)),\n// after (validate before finishing, re-download once if too small)\nif fs::metadata(file_path).await.map(|m| m.len()).unwrap_or(0) < expected_min_size {\n    download_to_file(url, file_path).await?;\n}\nresult = match fs::metadata(file_path).await {\n    Ok(metadata) if metadata.len() >= expected_min_size => Ok(()),\n    Ok(metadata) => Err(anyhow!(\"Downloaded model file is too small: {} bytes (expected at least {} bytes)\", metadata.len(), expected_min_size)),","handlingStrategy":"validation","validationCode":"// Pre-check after any manual download\nconst meta = await stat(modelPath);\nconst minBytes = Math.floor(knownSizeMb * 0.9) * 1024 * 1024;\nif (meta.size < minBytes) throw new Error(`model too small: ${meta.size} < ${minBytes}`);","typeGuard":null,"tryCatchPattern":"// TypeScript (Tauri invoke caller)\ntry {\n  await invoke('download_model_from_url', { url, modelName });\n} catch (e) {\n  if (String(e).includes('too small')) {\n    await invoke('delete_model_file', { modelName });\n    await invoke('download_model_from_url', { url, modelName }); // one retry\n  } else { throw e; }\n}","preventionTips":["Download models on stable connections; avoid flaky Wi-Fi or metered connections that drop mid-transfer.","Keep sufficient free disk space in the model storage directory.","Compare Content-Length with the expected model size before accepting the response.","Use downloaders that fail on partial bodies rather than silently saving truncated files."],"tags":["download","whisper","validation","network"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"a2cb62e827da7ef59f65064c97233efb2313878e","analyzedAt":"2026-09-12T11:12:14.152Z","contentChangedAt":"2026-09-12T11:12:14.152Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}