{"record":{"id":"205a5d9813d3a23b","repo":"Zackriya-Solutions/meetily","slug":"progress-byte-count-overflow","errorCode":null,"errorMessage":"Progress byte count overflow","messagePattern":"Progress byte count overflow","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":1064,"sourceCode":"                let next_confirmed_bytes = confirmed_bytes\n                    .checked_add(chunk_bytes)\n                    .ok_or_else(|| anyhow!(\"Progress overflow while downloading {}\", artifact.filename))?;\n                if next_confirmed_bytes > total_bytes {\n                    return Err(anyhow!(\"Download progress exceeds the catalog total\"));\n                }\n\n                writer\n                    .write_all(&chunk)\n                    .await\n                    .map_err(|error| anyhow!(\"Failed to write {}: {}\", artifact.filename, error))?;\n                artifact_bytes = next_artifact_bytes;\n                confirmed_bytes = next_confirmed_bytes;\n                streamed_bytes = streamed_bytes\n                    .checked_add(chunk_bytes)\n                    .ok_or_else(|| anyhow!(\"Streamed byte count overflow\"))?;\n                bytes_since_report = bytes_since_report\n                    .checked_add(chunk_bytes)\n                    .ok_or_else(|| anyhow!(\"Progress byte count overflow\"))?;\n\n                let progress = Self::in_flight_progress(confirmed_bytes, total_bytes, 0.0);\n                let elapsed = last_report.elapsed();\n                if progress.percent > last_percent\n                    || elapsed >= Duration::from_millis(500)\n                    || artifact_bytes == artifact.exact_bytes\n                {\n                    let speed_mbps = if elapsed.as_secs_f64() > 0.0 {\n                        bytes_since_report as f64 / (1024.0 * 1024.0) / elapsed.as_secs_f64()\n                    } else {\n                        0.0\n                    };\n                    if let Some(callback) = &progress_callback {\n                        callback(Self::in_flight_progress(\n                            confirmed_bytes,\n                            total_bytes,\n                            speed_mbps,\n                        ));","sourceCodeStart":1046,"sourceCodeEnd":1082,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/a2cb62e827da7ef59f65064c97233efb2313878e/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L1046-L1082","documentation":"Like the streamed counter, `bytes_since_report` (used to throttle progress-event emission) is advanced with a checked_add per chunk. An overflow triggers this defensive error. It is an internal invariant guard on progress-accounting state and should be unreachable with correct loop logic.","triggerScenarios":"`bytes_since_report.checked_add(chunk_bytes)` returns None in the chunk loop — corrupted progress-accounting state or an unbounded accumulation bug in the reporting path.","commonSituations":"Effectively never seen in normal use; would point to a code bug where bytes_since_report is not reset after each progress report or the loop never terminates.","solutions":["Restart the app and retry the download to clear corrupted state.","Verify the loop resets bytes_since_report after emitting a progress report (after the 500ms/percent-change threshold branch).","File a bug with logs if reproducible; it is not caused by user configuration."],"exampleFix":"// before: bytes_since_report accumulated without reset on emit\nif elapsed >= Duration::from_millis(500) {\n    emit_progress(progress);\n}\n// after: reset after emitting\nif elapsed >= Duration::from_millis(500) {\n    emit_progress(progress);\n    bytes_since_report = 0;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Same posture as 52: internal invariant — fail fast with reset and bug report\nif let Err(e) = result {\n    if e.to_string().contains(\"Progress byte count overflow\") {\n        log::error!(\"Progress accounting overflow — bytes_since_report not reset?\");\n        reset_progress_state();\n        return Err(e);\n    }\n}","preventionTips":["Always reset bytes_since_report to 0 after emitting a progress event.","Add a debug assertion that bytes_since_report <= streamed_bytes each iteration.","Cover the progress-throttle branch with unit tests."],"tags":["overflow","internal","parakeet","progress","invariant"],"backgroundTag":"internal-invariant-violation","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"}