tonhowtf/omniget · error

o gallery-dl falhou

Error message

o gallery-dl falhou: {}

What it means

download() treats the run as failed only when gallery-dl exited non-success AND no files were collected from stdout; in that case it throws this error with the stderr log tail as detail. If any files were produced, partial success is accepted and returned in Downloaded { files, log_tail }.

Solutions

  1. Read log_tail in the error for gallery-dl's own diagnostic
  2. Refresh cookies if the content is behind login
  3. Check free disk space and write permissions on the destination folder
  4. Retry with backoff on transient network/rate-limit errors; update gallery-dl if the extractor is outdated

Example fix

// before
let out = gdl::download(&url, &dest, Some(&cookies), limit, &progress).await?;
// after
let out = match gdl::download(&url, &dest, Some(&cookies), limit, &progress).await {
    Ok(o) if o.files.is_empty() && !o.log_tail.contains("403") => o,
    Err(e) if e.to_string().contains("falhou") => {
        refresh_cookies(&mut session)?;
        gdl::download(&url, &dest, Some(&session.cookie_path()), limit, &progress).await?
    }
    other => other?,
};
Defensive patterns

Strategy: retry

Validate before calling

let free = fs2::available_space(&dest)?;
anyhow::ensure!(free > 100 * 1024 * 1024, "espaço insuficiente em {:?}", dest);

Try / catch

match gdl::download(&url, &dest, cookies, limit, &progress).await {
    Ok(d) => d,
    Err(e) if e.to_string().contains("o gallery-dl falhou") => {
        if is_transient(&e) { retry_with_backoff(3, || gdl::download(&url, &dest, cookies, limit, &progress)).await? }
        else { return Err(e); }
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: gallery-dl exits with non-zero status and zero files were parsed: download aborted early (403, 404, network drop), disk full preventing output, extractor error, or auth rejection.

Common situations: Target media requires cookies that expired; Tumblr post removed/private; disk quota exceeded on dest; rate limiting interrupted the first file; broken extractor after a site layout change.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/tumblr/gdl.rs:392

        files
    });
    let err_task = tokio::spawn(async move {
        let mut tail = String::new();
        if let Some(e) = stderr {
            let mut lines = BufReader::new(e).lines();
            while let Ok(Some(line)) = lines.next_line().await {
                if !line.trim().is_empty() {
                    tail = line;
                }
            }
        }
        tail
    });
    let status = child.wait().await?;
    let files = out_task.await.unwrap_or_default();
    let log_tail = err_task.await.unwrap_or_default();
    if !status.success() && files.is_empty() {
        return Err(anyhow!("o gallery-dl falhou: {}", log_tail));
    }
    Ok(Downloaded { files, log_tail })
}

#[cfg(test)]
mod tests {
    use super::*;

    const DUMP: &str = r#"[
      [2, {"category": "tumblr", "blog_name": "estudio"}],
      [3, "https://64.media.tumblr.com/abc/foto_1280.jpg",
        {"id": 700111222, "blog_name": "estudio", "type": "photo",
         "tags": ["arte", "aquarela"], "date": "2024-03-02 10:00:00",
         "post_url": "https://estudio.tumblr.com/post/700111222"}],
      [6, "https://outro.tumblr.com/post/1", {"category": "tumblr"}]
    ]"#;

    #[test]

View on GitHub (pinned to 8600b91f42)