tonhowtf/omniget · error

não foi possível iniciar o gallery-dl

Error message

não foi possível iniciar o gallery-dl: {}

What it means

dump() builds a tokio Command for gallery-dl and spawns it; if the OS fails to create the process (executable missing despite earlier checks, exec permission denied, etc.) the spawn error is wrapped in this message with the underlying io::Error interpolated.

Solutions

  1. Read the wrapped io::Error in the message to identify the exact OS failure (NotFound, PermissionDenied, etc.)
  2. Re-run ensure_gallerydl()/reinstall gallery-dl if the binary vanished
  3. chmod +x the gallery-dl binary on Unix systems
  4. Whitelist the binary in antivirus/security policy on Windows

Example fix

// before
// PermissionDenied on downloaded binary
let dump = gdl::dump(&url, cookies, limit).await?;
// after
let path = gdl::binary_path().await?;
use std::os::unix::fs::PermissionsExt;
std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o755))?;
let dump = gdl::dump(&url, cookies, limit).await?;
Defensive patterns

Strategy: try-catch

Validate before calling

use std::os::unix::fs::PermissionsExt;
if let Ok(md) = std::fs::metadata(&bin) {
    anyhow::ensure!(md.permissions().mode() & 0o111 != 0, "gallery-dl sem permissão de execução");
}

Try / catch

match gdl::dump(&url, cookies, limit).await {
    Ok(d) => d,
    Err(e) if e.to_string().contains("não foi possível iniciar o gallery-dl") => {
        eprintln!("verifique existência/permissão do binário: {e}");
        return Err(e);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Command::spawn() returns Err: binary path resolved by binary() no longer exists or is not executable at spawn time, PATH lookup failed, or the exec failed due to permissions/ENODEV-style OS errors.

Common situations: Binary deleted between resolution and spawn; downloaded file lacks the executable bit (Linux/macOS); PATH changed at runtime; sandbox or security policy blocks executing downloaded binaries.

Related errors


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

Appendix: source

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

    let mut cmd = crate::core::process::command(&bin);
    cmd.arg("-j");
    if let Some(r) = range_arg(limit) {
        cmd.args(["--range", &r]);
    }
    if let Some(c) = cookies {
        cmd.arg("--cookies").arg(c);
    }
    for a in extra {
        cmd.arg(a);
    }
    cmd.arg(url)
        .stdin(std::process::Stdio::null())
        .stdout(std::process::Stdio::piped())
        .stderr(std::process::Stdio::piped());

    let mut child = cmd
        .spawn()
        .map_err(|e| anyhow!("não foi possível iniciar o gallery-dl: {}", e))?;
    let mut stdout = child
        .stdout
        .take()
        .ok_or_else(|| anyhow!("o gallery-dl não abriu a saída padrão"))?;
    let stderr = child.stderr.take();

    let err_task = tokio::spawn(async move {
        use tokio::io::{AsyncBufReadExt, BufReader};
        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

View on GitHub (pinned to 8600b91f42)