tonhowtf/omniget · error · anyhow::Error

Downloaded file from

Error message

Downloaded file from {} is too small ({}B) — likely an error page

What it means

After writing the downloaded archive to a temp file, download_ffmpeg() checks its size and rejects anything under 1,000,000 bytes, assuming a mirror served an HTML error page or truncated response instead of the real FFmpeg archive. The temp file is deleted and the URL plus actual size are reported.

Solutions

  1. Inspect the response from the URL manually (curl -L) — it is likely HTML, not an archive
  2. Switch to a working mirror / update the URL list in download_ffmpeg
  3. Retry later if the mirror or network is degraded
  4. Bypass any proxy that rewrites responses
  5. If legitimate archives could be under 1MB (custom builds), adjust the size threshold
Defensive patterns

Strategy: validation

Validate before calling

if let Ok(meta) = std::fs::metadata(tmp) {
    if meta.len() < 1_000_000 {
        eprintln!("downloaded payload too small — mirror returned an error page");
    }
}

Try / catch

match download_ffmpeg().await {
    Ok(p) => ...,
    Err(e) if e.to_string().contains("too small") => try_next_mirror(),
    Err(e) => ...,
}

Prevention

When it happens

Trigger: The mirror returned an HTML error page (login/captcha/soft-404), the response was truncated by a proxy, or a redirect landed on a small landing page instead of the archive.

Common situations: Mirror soft-404 after upstream path change; captive portal or proxy interception; CDN serving a tiny error body with 200 OK; disk-quota truncation in rare setups.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/dependencies.rs:435

            return Err(anyhow!(
                "Failed to download FFmpeg from {}: HTTP {}",
                url,
                response.status()
            ));
        }

        let temp_path = bin_dir.join(".ffmpeg_download.tmp");
        let bytes = response.bytes().await?;
        let data = bytes.to_vec();
        let temp_clone = temp_path.clone();
        tokio::task::spawn_blocking(move || std::fs::write(&temp_clone, &data))
            .await
            .map_err(|e| anyhow!("spawn_blocking failed: {}", e))??;

        let file_size = std::fs::metadata(&temp_path)?.len();
        if file_size < 1_000_000 {
            let _ = std::fs::remove_file(&temp_path);
            return Err(anyhow!(
                "Downloaded file from {} is too small ({}B) — likely an error page",
                url,
                file_size
            ));
        }

        match archive_type {
            ArchiveType::Zip => {
                extract_zip_ffmpeg(&temp_path, &bin_dir, &ffmpeg_name, &ffprobe_name).await?
            }
            ArchiveType::TarXz => {
                extract_tar_xz_ffmpeg(&temp_path, &bin_dir, &ffmpeg_name, &ffprobe_name).await?
            }
        }

        let _ = std::fs::remove_file(&temp_path);
    }

View on GitHub (pinned to 8600b91f42)