tonhowtf/omniget · error

nao foi possivel iniciar o aria2c

Error message

nao foi possivel iniciar o aria2c: {}

What it means

aria2::download builds a tokio::process::Command for the external aria2c binary and calls spawn(). If the OS cannot start the process, the error is wrapped with this Portuguese message including the underlying io::Error. It means the downloader never even launched; no network or aria2c-side issue is involved.

Solutions

  1. Install aria2 (apt install aria2 / brew install aria2) and verify with `aria2c --version` in the same environment the app runs in.
  2. Check the absolute path used to build the Command; pass an explicit path to the binary if it is not on the runtime PATH.
  3. Check execute permissions and architecture of the aria2c binary.
  4. Fall back to the library's non-aria2 download path if aria2c is unavailable.

Example fix

// before
let mut child = cmd.spawn().map_err(|e| anyhow!("nao foi possivel iniciar o aria2c: {}", e))?;
// after
let bin = which::which("aria2c").map_err(|_| anyhow!("aria2c nao encontrado no PATH; instale o pacote aria2"))?;
let mut cmd = Command::new(bin);
let mut child = cmd.spawn().map_err(|e| anyhow!("nao foi possivel iniciar o aria2c: {}", e))?;
Defensive patterns

Strategy: try-catch

Validate before calling

// shell: command -v aria2c || echo 'aria2c nao instalado'
// rust: which::which("aria2c").is_ok()

Try / catch

match aria2::download(opts).await {
    Err(e) if e.to_string().contains("nao foi possivel iniciar o aria2c") => {
        eprintln!("aria2c ausente: instale o pacote aria2 ou informe o caminho do binario");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling aria2::download when the aria2c executable is not installed, is not on PATH, or cannot be executed (bad permissions, missing working directory, exec format error on wrong-architecture binary).

Common situations: Deploying to a fresh container/CI image without aria2 installed; user PATH missing /usr/local/bin where aria2c lives; bundling a binary built for another OS/architecture; SELinux or antivirus blocking exec.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/aria2.rs:106

    ]);
    if !opts.file_name.trim().is_empty() {
        cmd.args(["--out", opts.file_name.trim()]);
    }
    if !opts.sha256.trim().is_empty() {
        cmd.arg(format!("--checksum=sha-256={}", opts.sha256.trim()));
    }
    for h in &opts.headers {
        if !h.trim().is_empty() {
            cmd.arg(format!("--header={}", h.trim()));
        }
    }
    cmd.arg(&opts.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 aria2c: {}", e))?;
    let stdout = child.stdout.take();
    let id = format!("aria2:{}", opts.url);
    let p2 = progress.clone();
    let id2 = id.clone();
    let task = tokio::spawn(async move {
        let mut last = String::new();
        if let Some(o) = stdout {
            let mut lines = BufReader::new(o).lines();
            while let Ok(Some(line)) = lines.next_line().await {
                if let Some((pct, speed)) = parse_progress(&line) {
                    super::report(&p2, &id2, "progress", pct, Some(100), Some(speed));
                } else if !line.trim().is_empty() {
                    last = line;
                }
            }
        }
        last
    });

View on GitHub (pinned to 8600b91f42)