{"record":{"id":"ce57ecdabb38e778","repo":"tonhowtf/omniget","slug":"ffmpeg-installed-but-failed-to-execute","errorCode":null,"errorMessage":"FFmpeg installed but failed to execute: {}","messagePattern":"FFmpeg installed but failed to execute: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/dependencies.rs","lineNumber":529,"sourceCode":"        tokio::task::spawn_blocking(move || {\n            crate::core::process::std_command(&target)\n                .arg(\"-version\")\n                .stdout(Stdio::null())\n                .stderr(Stdio::null())\n                .status()\n        })\n        .await\n        .map_err(|e| anyhow!(\"spawn_blocking failed: {}\", e))?\n    };\n    match verify {\n        Ok(s) if s.success() => {}\n        Ok(s) => {\n            return Err(anyhow!(\n                \"FFmpeg installed but failed to execute (exit code {})\",\n                s\n            ))\n        }\n        Err(e) => return Err(anyhow!(\"FFmpeg installed but failed to execute: {}\", e)),\n    }\n\n    tracing::info!(\"FFmpeg installed to {}\", ffmpeg_target.display());\n    Ok(ffmpeg_target)\n}\n\nenum ArchiveType {\n    Zip,\n    TarXz,\n}\n\nfn ffmpeg_download_urls() -> Vec<(&'static str, ArchiveType)> {\n    if cfg!(target_os = \"windows\") {\n        vec![(\n            \"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip\",\n            ArchiveType::Zip,\n        )]\n    } else if cfg!(target_os = \"macos\") {","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/dependencies.rs#L511-L547","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["chmod +x the installed ffmpeg binary (extraction likely skipped the exec bit)","Check the OS error text: 'Exec format error' means wrong architecture — download the correct build","Ensure bin_dir is not on a noexec mount","Check antivirus quarantine and re-extract","Re-run ensure_ffmpeg after fixing permissions"],"exampleFix":"// before (after extraction)\n// no permission fix\n// after\n#[cfg(unix)]\n{\n    use std::os::unix::fs::PermissionsExt;\n    std::fs::set_permissions(&ffmpeg_target, std::fs::Permissions::from_mode(0o755))?;\n}","handlingStrategy":"try-catch","validationCode":"#[cfg(unix)]\nlet exec_ok = std::fs::metadata(&ffmpeg_path)\n    .map(|m| m.permissions().mode() & 0o111 != 0)\n    .unwrap_or(false);\n#[cfg(not(unix))]\nlet exec_ok = ffmpeg_path.exists();","typeGuard":null,"tryCatchPattern":"match download_ffmpeg().await {\n    Ok(p) => ...,\n    Err(e) if e.to_string().contains(\"failed to execute\") => {\n        #[cfg(unix)]\n        set_exec_bit_and_retry(&ffmpeg_path);\n    }\n    Err(e) => ...,\n}","preventionTips":["Set the executable bit (0o755) on extracted binaries on Unix","Avoid installing to noexec-mounted directories","Use platform-correct archives per OS/arch","Exclude the bin_dir from antivirus quarantine"],"tags":["ffmpeg","process","permissions","platform"],"backgroundTag":"command-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}