tonhowtf/omniget · error · anyhow::Error

Only of segments were written

Error message

Only {} of {} segments were written

What it means

Integrity check in write_segments_ordered: after draining the reassembly buffer, fewer segments than the playlist declared were successfully written — gaps in the sequence mean the output would be corrupt, so the partial file is rejected instead of shipped.

Solutions

  1. Retry the download; missing segments are usually transient network failures
  2. Increase segment retry count and concurrency resilience
  3. Verify the playlist was not modified mid-download (VOD vs live mismatch)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src-tauri/omniget-core/src/core/hls_downloader.rs:692 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/e9026cb092cee112. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/hls_downloader.rs:692

                    buf.drain(..payload_start);
                }
                let decryptor = Aes128CbcDec::new_from_slices(&enc.key_bytes, &iv)
                    .map_err(|e| anyhow::anyhow!("AES init: {:?}", e))?;
                let decrypted = decryptor
                    .decrypt_padded_mut::<Pkcs7>(&mut buf)
                    .map_err(|e| anyhow::anyhow!("AES decrypt: {:?}", e))?;
                file.write_all(decrypted)?;
            } else {
                file.write_all(&segment_data[payload_start..])?;
            }
            next_expected += 1;
        }
    }

    file.flush()?;

    if next_expected < total_segments {
        anyhow::bail!(
            "Only {} of {} segments were written",
            next_expected,
            total_segments
        );
    }

    Ok(())
}

const SEGMENT_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(60);

async fn download_segment_with_retry(
    client: &Client,
    url: &str,
    referer: &str,
    user_agent: &str,
    max_retries: u32,
    cancel: &CancellationToken,

View on GitHub (pinned to 8600b91f42)