{"record":{"id":"bad78b65ce95f5f5","repo":"Zackriya-Solutions/meetily","slug":"download-confirmed-bytes-expected-bytes","errorCode":null,"errorMessage":"Download confirmed {} bytes, expected {} bytes","messagePattern":"Download confirmed (.+?) bytes, expected (.+?) bytes","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":1115,"sourceCode":"            if active_download.cancellation.is_cancelled() {\n                return Err(DownloadCancelled.into());\n            }\n            let stored_bytes = fs::metadata(&file_path)\n                .await\n                .map_err(|error| anyhow!(\"Failed to read {} after download: {}\", artifact.filename, error))?\n                .len();\n            if stored_bytes != artifact.exact_bytes {\n                return Err(anyhow!(\n                    \"{} stored {} bytes, expected exactly {} bytes\",\n                    artifact.filename,\n                    stored_bytes,\n                    artifact.exact_bytes\n                ));\n            }\n        }\n\n        if confirmed_bytes != total_bytes {\n            return Err(anyhow!(\n                \"Download confirmed {} bytes, expected {} bytes\",\n                confirmed_bytes,\n                total_bytes\n            ));\n        }\n        let elapsed = download_started.elapsed().as_secs_f64();\n        let speed_mbps = if elapsed > 0.0 {\n            streamed_bytes as f64 / (1024.0 * 1024.0) / elapsed\n        } else {\n            0.0\n        };\n        Ok((\n            DownloadProgress::new(total_bytes, total_bytes, speed_mbps),\n            progress_callback,\n        ))\n    }\n\n    async fn finish_download(","sourceCodeStart":1097,"sourceCodeEnd":1133,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/a2cb62e827da7ef59f65064c97233efb2313878e/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L1097-L1133","documentation":"End-of-download total verification. The engine accumulates confirmed_bytes as each artifact is verified and compares the total against total_bytes before declaring the download complete. A mismatch means the overall downloaded set diverges from the expected manifest total, even if individual per-file checks passed.","triggerScenarios":"After all artifact checks in the download loop, the accumulated confirmed_bytes differs from the expected total_bytes — e.g., a partially completed multi-part download, an artifact skipped early, or manifest total_bytes not matching the sum of the individual artifact sizes.","commonSituations":"A model manifest (total_bytes) out of sync with its per-artifact sizes after a server-side update; a download resumed from a partial state missing an artifact; an earlier non-fatal warning path skipping a file while the total stayed unchanged.","solutions":["Delete the partially downloaded model directory and restart the full download from scratch.","Check manifest consistency: confirm total_bytes equals the sum of each artifact's exact_bytes.","Retry on a stable network connection; use a wired connection or different network if on flaky Wi-Fi.","Update the app so the embedded manifest matches the current server-side model files."],"exampleFix":"// before\nif confirmed_bytes != total_bytes {\n    return Err(anyhow!(\"Download confirmed {} bytes, expected {} bytes\", confirmed_bytes, total_bytes));\n}\n// after (derive total from artifacts to keep invariant)\nlet total_bytes: u64 = artifacts.iter().map(|a| a.exact_bytes).sum();\nif confirmed_bytes != total_bytes {\n    return Err(anyhow!(\"Download confirmed {} bytes, expected {} bytes\", confirmed_bytes, total_bytes));\n}","handlingStrategy":"validation","validationCode":"// Assert manifest invariant before downloading\nlet sum: u64 = artifacts.iter().map(|a| a.exact_bytes).sum();\nassert_eq!(sum, total_bytes, \"manifest total_bytes must equal sum of artifact sizes\");","typeGuard":null,"tryCatchPattern":"// Rust\nif let Err(e) = download_model(name).await {\n    if e.to_string().contains(\"Download confirmed\") {\n        clean_partial_download(name)?;\n        download_model(name).await?; // one full retry from scratch\n    } else { return Err(e); }\n}","preventionTips":["Keep total_bytes derived from per-artifact exact_bytes instead of hardcoding it.","Restart multi-artifact downloads from scratch rather than resuming partial state.","Download over reliable networks; avoid pausing/resuming downloads mid-transfer.","Log per-artifact confirmed sizes so a total mismatch can be localized quickly."],"tags":["download","integrity","network","rust"],"backgroundTag":"checksum-mismatch","analyzedSha":"a2cb62e827da7ef59f65064c97233efb2313878e","analyzedAt":"2026-09-12T11:12:14.152Z","contentChangedAt":"2026-09-12T11:12:14.152Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}