tonhowtf/omniget · error

o gallery-dl não abriu a saída padrão

Error message

o gallery-dl não abriu a saída padrão

What it means

After spawning gallery-dl, dump() takes the piped stdout handle; if it is unexpectedly absent, this error is thrown. Stdout was configured as piped, so a None here is an internal invariant violation meaning the child could not provide the standard output stream.

Solutions

  1. Check that stdout(Stdio::piped()) is still set on the Command in dump()
  2. Raise the file-descriptor limit (ulimit -n) if the system is exhausting pipes
  3. Retry; if reproducible, report as a bug since piped stdout should always be available

Example fix

// before
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"))?;
// after
let mut child = cmd.stdout(std::process::Stdio::piped()).spawn().map_err(|e| anyhow!("spawn falhou: {}", e))?;
let Some(mut stdout) = child.stdout.take() else {
    anyhow::bail!("o gallery-dl não abriu a saída padrão (stdout não estava piped)");
};
Defensive patterns

Strategy: try-catch

Try / catch

let dump = gdl::dump(&url, cookies, limit).await
    .map_err(|e| { eprintln!("falha no pipe do gallery-dl: {e}"); e })?;

Prevention

When it happens

Trigger: child.stdout.take() returns None right after spawn despite Stdio::piped() being set — essentially only if the Command was misconfigured before this point or the pipe creation failed at the OS level.

Common situations: Very rare; typically indicates library-internal misconfiguration, extreme resource exhaustion (fd limit), or a modified code path where stdout was no longer piped.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

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

    }
    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
    });

    super::super::report(progress, id, "started", 0, None, None);
    let mut text = String::new();

View on GitHub (pinned to 8600b91f42)