tonhowtf/omniget · error

galeria falhou ( ); gallery-dl

Error message

galeria falhou ({}); gallery-dl: {}

What it means

Plan::Gallery downloads failed twice: the direct fetch of each gallery URL returned Err(e), and the gallery-dl fallback also failed with error g. The library aggregates both errors into this single message so you can see the direct failure and the fallback failure together.

Solutions

  1. Read both parts of the message: fix the direct error e first (usually expired/403 media URLs)
  2. Ensure gallery-dl is installed and runnable: `gallery-dl --version`
  3. Run with a session cookie (opts.session_netscape) to avoid Reddit rate limits/blocks
  4. Confirm the post/gallery still exists at info.permalink in a browser

Example fix

// shell: install fallback downloader
// before: gallery-dl missing -> "galeria falhou (404); gallery-dl: No such file..."
// after
pip install gallery-dl && gallery-dl --version
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling, verify gallery-dl availability
let ok = std::process::Command::new("gallery-dl").arg("--version").output().is_ok();
if !ok { eprintln!("gallery-dl missing — install it for gallery fallback"); }

Try / catch

match run(opts).await {
    Err(e) if e.to_string().starts_with("galeria falhou") => {
        // parse 'galeria falhou ({direct}); gallery-dl: {fallback}' and act:
        // retry later (rate limit), install gallery-dl, or fetch media manually
    }
    other => other?,
}

Prevention

When it happens

Trigger: Gallery post whose image URLs 404/expired or fail auth (direct path), and gallery-dl is absent, failing, or rate-limited on info.permalink (fallback path).

Common situations: gallery-dl not installed or not on PATH; Reddit rate-limiting anonymous requests; deleted/quarantined galleries; media hosts returning 403 for hotlinked images.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/reddit/download.rs:600

            let (f, tail) = run_ytdlp(url, &dest, &base, opts, &progress).await?;
            ("video", "yt-dlp", f, tail)
        }
        Plan::External { url } => {
            let (f, tail) = run_ytdlp(url, &dest, &base, opts, &progress).await?;
            ("external", "yt-dlp", f, tail)
        }
        Plan::Image { url } => {
            let f = download_direct(&fetcher, std::slice::from_ref(url), &dest, &base, &progress)
                .await?;
            ("image", "direto", f, String::new())
        }
        Plan::Gallery { urls } => {
            match download_direct(&fetcher, urls, &dest, &base, &progress).await {
                Ok(f) => ("gallery", "direto", f, String::new()),
                Err(e) => {
                    let (f, tail) = download_gallery_dl(&info.permalink, &dest, &progress)
                        .await
                        .map_err(|g| anyhow!("galeria falhou ({}); gallery-dl: {}", e, g))?;
                    ("gallery", "gallery-dl", f, tail)
                }
            }
        }
        Plan::TextOnly => ("text", "nenhum", Vec::new(), String::new()),
    };

    if opts.write_info && post.is_some() {
        let want_json = opts.info_format != "txt";
        let want_txt = opts.info_format == "txt" || opts.info_format == "both";
        if want_json {
            let path = dest.join(format!("{}.json", base));
            std::fs::write(&path, serde_json::to_string_pretty(&info)?)?;
            files.push(path.to_string_lossy().to_string());
        }
        if want_txt {
            let path = dest.join(format!("{}.txt", base));
            std::fs::write(&path, info_txt(&info))?;

View on GitHub (pinned to 8600b91f42)