{"record":{"id":"ca1853a0eb70322a","repo":"tonhowtf/omniget","slug":"ffmpeg-is-provided-by-the-flatpak-runtime-and-cannot-be","errorCode":null,"errorMessage":"FFmpeg is provided by the Flatpak runtime and cannot be updated from inside the app","messagePattern":"FFmpeg is provided by the Flatpak runtime and cannot be updated from inside the app","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"src-tauri/omniget-core/src/core/dependencies.rs","lineNumber":366,"sourceCode":"            ));\n        }\n        if let Err(e) = std::fs::rename(temp, target) {\n            let _ = std::fs::rename(&old, target);\n            let _ = std::fs::remove_file(temp);\n            return Err(anyhow!(\"Failed to replace {}: {}\", file_name, e));\n        }\n        let _ = std::fs::remove_file(&old);\n        Ok(())\n    } else {\n        std::fs::rename(temp, target)\n            .map_err(|e| anyhow!(\"Failed to replace {}: {}\", target.display(), e))?;\n        Ok(())\n    }\n}\n\npub async fn update_ffmpeg() -> anyhow::Result<PathBuf> {\n    if is_flatpak() {\n        return Err(anyhow!(\n            \"FFmpeg is provided by the Flatpak runtime and cannot be updated from inside the app\"\n        ));\n    }\n    let path = download_ffmpeg().await?;\n    crate::core::ytdlp::reset_ffmpeg_location_cache();\n    Ok(path)\n}\n\npub async fn ensure_ffmpeg() -> anyhow::Result<PathBuf> {\n    // Always ensure the managed binary exists — the standalone yt-dlp.exe\n    // cannot discover system FFmpeg from PATH.\n    if !is_flatpak() {\n        let managed = managed_bin_dir().map(|d| d.join(bin_name(\"ffmpeg\")));\n        if managed.as_ref().map_or(true, |p| !p.exists()) {\n            if let Ok(path) = download_ffmpeg().await {\n                crate::core::ytdlp::reset_ffmpeg_location_cache();\n                return Ok(path);\n            }","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/dependencies.rs#L348-L384","documentation":"update_ffmpeg refuses to run inside a Flatpak sandbox because FFmpeg there is supplied by the Flatpak runtime, not managed by the app. Updating it from inside the app is impossible (the runtime is read-only from the sandbox's perspective), so the call fails fast with this explanatory message.","triggerScenarios":"Calling update_ffmpeg (UI 'update ffmpeg' action) while the app runs as a Flatpak (is_flatpak() detects the sandbox, e.g. via /.flatpak-info).","commonSituations":"User installed the app from Flathub and clicks 'Update FFmpeg'; expecting bundled-runtime ffmpeg to be upgradable in-app.","solutions":["Don't expose/call update_ffmpeg when running under Flatpak; hide the update button in that environment.","Update FFmpeg by updating the Flatpak runtime: flatpak update (or the relevant runtime extension, e.g. org.freedesktop.Platform.ffmpeg-full).","If a newer ffmpeg is truly needed, wait for a runtime/extension update upstream or use a non-Flatpak install."],"exampleFix":"// before\nupdate_ffmpeg().await?;\n// after\nif dependencies::is_flatpak() {\n    eprintln!(\"Update FFmpeg via the Flatpak runtime: flatpak update\");\n    return Ok(());\n}\nupdate_ffmpeg().await?;","handlingStrategy":"type-guard","validationCode":"if dependencies::is_flatpak() {\n    eprintln!(\"FFmpeg updates come from the Flatpak runtime; run: flatpak update\");\n    return Ok(());\n}","typeGuard":"fn can_update_ffmpeg_in_app() -> bool { !dependencies::is_flatpak() }","tryCatchPattern":"match update_ffmpeg().await {\n    Ok(p) => p,\n    Err(e) if format!(\"{e}\").contains(\"Flatpak runtime\") => {\n        eprintln!(\"Update the Flatpak runtime instead: flatpak update\");\n        return Ok(());\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check is_flatpak() before showing any in-app FFmpeg update UI.","Show runtime-extension update instructions to Flatpak users.","Add CI coverage for Flatpak build paths to catch sandbox-only code paths."],"tags":["flatpak","linux","sandbox","unsupported-operation"],"backgroundTag":"unsupported-platform","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"}