Zackriya-Solutions/meetily · error · anyhow::Error

Failed to read chunk

Error message

Failed to read chunk: {}

What it means

response.bytes_stream() yielded an Err while reading the body: the connection broke mid-transfer (ECONNRESET, read timeout, TLS error). A partial ggml file remains on disk and the model status is left Downloading, so it must be cleaned up or overwritten before the model is usable.

Solutions

  1. Retry download_model — it truncates and rewrites the file from byte 0
  2. On flaky links prefer smaller or quantized models (base, small, *-q5_0/q5_1) to shrink the transfer window
  3. Stabilize the network or raise client timeouts; there is no HTTP Range resume support in this loop
Defensive patterns

Strategy: retry

Try / catch

let mut attempts = 0;
loop {
  match engine.download_model(name, cb.clone()).await {
    Ok(_) => break,
    Err(e) if String::from(&e).contains("Failed to read chunk") && attempts < 3 => {
      attempts += 1;
      tokio::time::sleep(Duration::from_secs(2u64.pow(attempts))).await;
    }
    Err(e) => return Err(e),
  }
}

Prevention

When it happens

Trigger: Wi-Fi drop or VPN reconnect during a multi-GB large-v3 fetch; server or proxy closing the connection on idle; network switch mid-download.

Common situations: Long downloads over hotel/mobile networks; aggressive proxy idle timeouts; huggingface CDN node failures mid-stream.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@a2cb62e827 (2026-09-12). Data as JSON: /api/errors/5691cde8c53b1acb. Report an issue: GitHub.

Appendix: source

Thrown at frontend/src-tauri/src/whisper_engine/whisper_engine.rs:1188

            callback(0);
        }

        loop {
            let chunk_result = tokio::select! {
                biased;
                _ = active_download.cancellation.cancelled() => return Err(DownloadCancelled.into()),
                chunk_result = stream.next() => chunk_result,
            };

            let Some(chunk_result) = chunk_result else {
                break;
            };

            if active_download.cancellation.is_cancelled() {
                return Err(DownloadCancelled.into());
            }

            let chunk = chunk_result.map_err(|e| anyhow!("Failed to read chunk: {}", e))?;
            file.write_all(&chunk)
                .await
                .map_err(|e| anyhow!("Failed to write chunk to file: {}", e))?;

            downloaded += chunk.len() as u64;
            let progress = if total_size > 0 {
                ((downloaded as f64 / total_size as f64) * 100.0) as u8
            } else {
                0
            };

            let time_since_last_report = last_report_time.elapsed().as_secs();
            if progress >= last_progress_report + 1 || progress == 100 || time_since_last_report >= 2 {
                let mut models = self.available_models.write().await;
                if let Some(model_info) = models.get_mut(model_name) {
                    model_info.status = ModelStatus::Downloading { progress };
                }

View on GitHub (pinned to a2cb62e827)