tonhowtf/omniget · error

nao foi possivel iniciar o gallery-dl

Error message

nao foi possivel iniciar o gallery-dl: {}

What it means

download() spawns the gallery-dl child process; if std::process::Command::spawn fails (the OS cannot start the binary), the OS error is wrapped in this message. Unlike the 'nao esta instalado' error, the binary was resolved but could not actually be executed.

Solutions

  1. Check the OS error in the message — 'Permission denied' means chmod +x (Unix) or unblock the binary
  2. Reinstall/re-download gallery-dl — the binary may be corrupt or for the wrong architecture
  3. Confirm the resolved path runs directly from a shell: `<path> --version`

Example fix

// before (linux fix, terminal)
gallery-dl --version
// permission denied? after
chmod +x $(which gallery-dl)
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the resolved binary is executable
use std::os::unix::fs::PermissionsExt;
let meta = std::fs::metadata(&bin)?;
if meta.permissions().mode() & 0o111 == 0 {
    std::fs::set_permissions(&bin, std::fs::Permissions::from_mode(0o755))?;
}

Try / catch

match gallery::download(url, dest, cookies, progress).await {
    Err(e) if e.to_string().contains("nao foi possivel iniciar") => {
        // fix permissions / reinstall, then retry once
        reinstall_gallerydl().await?;
        gallery::download(url, dest, cookies, progress).await?
    }
    other => other?,
}

Prevention

When it happens

Trigger: cmd.spawn() returns Err: binary path exists but is not executable, permission denied on the file, missing interpreter/shebang, or resource limits preventing process creation.

Common situations: Downloaded binary not marked executable on Linux/macOS; antivirus blocking execution on Windows; corrupted or zero-length binary; exec format mismatch (arm64 binary on x64).

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/gallery.rs:63

    progress: super::ProgressFn,
) -> anyhow::Result<GalleryResult> {
    use tokio::io::{AsyncBufReadExt, BufReader};
    let bin = crate::core::dependencies::ensure_gallerydl()
        .await
        .ok_or_else(|| anyhow!("gallery-dl nao esta instalado"))?;
    std::fs::create_dir_all(dest)?;
    let mut cmd = crate::core::process::command(&bin);
    cmd.args(["-d", dest, "--write-metadata"]);
    if let Some(c) = cookies_file.filter(|c| !c.trim().is_empty()) {
        cmd.args(["--cookies", c]);
    }
    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!("nao foi possivel iniciar o gallery-dl: {}", e))?;
    let stdout = child.stdout.take();
    let stderr = child.stderr.take();
    let id = format!("gallery:{}", url);
    let p2 = progress.clone();
    let id2 = id.clone();
    let out_task = tokio::spawn(async move {
        let mut files = Vec::new();
        if let Some(o) = stdout {
            let mut lines = BufReader::new(o).lines();
            while let Ok(Some(line)) = lines.next_line().await {
                let l = line.trim().trim_start_matches("# ").to_string();
                if !l.is_empty() {
                    files.push(l.clone());
                    super::report(&p2, &id2, "download", files.len() as u64, None, Some(l));
                }
            }
        }
        files

View on GitHub (pinned to 8600b91f42)