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.

Source

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

        if let Some(ref callback) = progress_callback {
            callback(0);
        }

        while let Some(chunk_result) = stream.next().await {
            // Check for cancellation before processing chunk
            {
                let cancel_flag = self.cancel_download_flag.read().await;
                if cancel_flag.as_ref() == Some(&model_name.to_string()) {
                    log::info!("Download cancelled for {}", model_name);
                    // Remove from active downloads on cancellation
                    let mut active = self.active_downloads.write().await;
                    active.remove(model_name);
                    return Err(anyhow!("Download cancelled by user"));
                }
            }

            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;

            // Calculate progress
            let progress = if total_size > 0 {
                ((downloaded as f64 / total_size as f64) * 100.0) as u8
            } else {
                0
            };

            // Report progress every 1% or every 2 seconds for better UI responsiveness
            let time_since_last_report = last_report_time.elapsed().as_secs();
            if progress >= last_progress_report + 1 || progress == 100 || time_since_last_report >= 2 {
                log::info!("Download progress: {}% ({:.1} MB / {:.1} MB)",
                         progress,

View on GitHub (pinned to 0281737d87)

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@0281737d87 (2026-08-16). Data as JSON: /api/errors/5691cde8c53b1acb. Report an issue: GitHub.