{"record":{"id":"fa4cf592046f3aa6","repo":"Zackriya-Solutions/meetily","slug":"streamed-byte-count-overflow","errorCode":null,"errorMessage":"Streamed byte count overflow","messagePattern":"Streamed byte count overflow","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":1061,"sourceCode":"                        artifact.exact_bytes\n                    ));\n                }\n                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,","sourceCodeStart":1043,"sourceCodeEnd":1079,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/a2cb62e827da7ef59f65064c97233efb2313878e/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L1043-L1079","documentation":"The engine tracks total streamed bytes across the whole download session with a checked_add on each chunk. If the running count would overflow the u64 counter, this defensive error is thrown. On a normal machine this is essentially impossible (u64 max ≈ 18 exabytes) and indicates corrupted accounting state or a runaway loop, so it is an internal invariant guard.","triggerScenarios":"`streamed_bytes.checked_add(chunk_bytes)` returns None in the chunk loop — only reachable if streamed_bytes is already astronomically large, i.e. corrupted accumulator state or a looping download driver.","commonSituations":"Practically never hit in the field; would only appear with a bug in the download loop (e.g. an infinite loop reusing an unreset counter across many artifacts) or memory corruption.","solutions":["Restart the app/retry the download to reset the counter state.","If reproducible, inspect the chunk loop for a failure to reset per-artifact counters, causing unbounded accumulation across artifacts.","Report as a bug with logs if it recurs — it indicates an internal accounting bug, not a user-configurable problem."],"exampleFix":"// before: counter never reset between artifacts\nlet mut streamed_bytes = 0u64;\nfor artifact in artifacts {\n    // ... accumulates across every retry, never reset\n}\n// after: reset per artifact\nfor artifact in artifacts {\n    let mut streamed_bytes = 0u64;\n    // ...\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Treat as an internal bug: log and fail fast, retry once with fresh state\nif let Err(e) = result {\n    if e.to_string().contains(\"Streamed byte count overflow\") {\n        log::error!(\"Internal accounting overflow in downloader, resetting state\");\n        reset_download_state();\n        return Err(e); // report as bug; retrying without reset will repeat\n    }\n}","preventionTips":["Reset per-artifact counters at the start of every artifact and every retry.","Add unit tests for the chunk loop with tiny total_bytes to catch accounting drift early.","Treat any occurrence as a code bug to file, not a user-facing condition."],"tags":["overflow","internal","parakeet","download","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"}