tonhowtf/omniget · error · anyhow::Error

FFmpeg installed but failed to execute

Error message

FFmpeg installed but failed to execute: {}

What it means

The `ffmpeg -version` verification spawn itself failed with an I/O error (std::process Command::status returned Err), e.g. the binary could not be executed at all. The OS error is embedded in this anyhow message, distinct from error 166 where the process ran but exited non-zero.

Solutions

  1. chmod +x the installed ffmpeg binary (extraction likely skipped the exec bit)
  2. Check the OS error text: 'Exec format error' means wrong architecture — download the correct build
  3. Ensure bin_dir is not on a noexec mount
  4. Check antivirus quarantine and re-extract
  5. Re-run ensure_ffmpeg after fixing permissions

Example fix

// before (after extraction)
// no permission fix
// after
#[cfg(unix)]
{
    use std::os::unix::fs::PermissionsExt;
    std::fs::set_permissions(&ffmpeg_target, std::fs::Permissions::from_mode(0o755))?;
}
Defensive patterns

Strategy: try-catch

Validate before calling

#[cfg(unix)]
let exec_ok = std::fs::metadata(&ffmpeg_path)
    .map(|m| m.permissions().mode() & 0o111 != 0)
    .unwrap_or(false);
#[cfg(not(unix))]
let exec_ok = ffmpeg_path.exists();

Try / catch

match download_ffmpeg().await {
    Ok(p) => ...,
    Err(e) if e.to_string().contains("failed to execute") => {
        #[cfg(unix)]
        set_exec_bit_and_retry(&ffmpeg_path);
    }
    Err(e) => ...,
}

Prevention

When it happens

Trigger: exec fails on the freshly extracted binary: permission bit not set, binary format not recognized (wrong architecture), missing interpreter/loader, or file deleted between extraction and verification.

Common situations: Extraction preserved the zip entry but not the executable permission (Windows archives used on Unix); ELF/Mach-O mismatch with the host; antivirus deleting the binary; noexec-mounted partition hosting bin_dir.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/dependencies.rs:529

        tokio::task::spawn_blocking(move || {
            crate::core::process::std_command(&target)
                .arg("-version")
                .stdout(Stdio::null())
                .stderr(Stdio::null())
                .status()
        })
        .await
        .map_err(|e| anyhow!("spawn_blocking failed: {}", e))?
    };
    match verify {
        Ok(s) if s.success() => {}
        Ok(s) => {
            return Err(anyhow!(
                "FFmpeg installed but failed to execute (exit code {})",
                s
            ))
        }
        Err(e) => return Err(anyhow!("FFmpeg installed but failed to execute: {}", e)),
    }

    tracing::info!("FFmpeg installed to {}", ffmpeg_target.display());
    Ok(ffmpeg_target)
}

enum ArchiveType {
    Zip,
    TarXz,
}

fn ffmpeg_download_urls() -> Vec<(&'static str, ArchiveType)> {
    if cfg!(target_os = "windows") {
        vec![(
            "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip",
            ArchiveType::Zip,
        )]
    } else if cfg!(target_os = "macos") {

View on GitHub (pinned to 8600b91f42)