{"record":{"id":"cecf3d2d06cb6448","repo":"tonhowtf/omniget","slug":"yt-dlp-is-provided-by-the-flatpak-runtime-and-cannot-be","errorCode":null,"errorMessage":"yt-dlp is provided by the Flatpak runtime and cannot be updated from inside the app","messagePattern":"yt-dlp is provided by the Flatpak runtime and cannot be updated from inside the app","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src-tauri/omniget-core/src/core/ytdlp.rs","lineNumber":1780,"sourceCode":"    std::thread::Builder::new()\n        .name(\"js-runtime-check\".into())\n        .spawn(|| {\n            let rt = tokio::runtime::Builder::new_current_thread()\n                .enable_all()\n                .build()\n                .expect(\"js-runtime runtime\");\n            rt.block_on(async {\n                crate::core::dependencies::ensure_js_runtime().await;\n            });\n        })\n        .ok();\n    tracing::debug!(\"[perf] ensure_ytdlp took {:?}\", _timer_start.elapsed());\n    Ok(path)\n}\n\npub async fn update_ytdlp() -> anyhow::Result<PathBuf> {\n    if crate::core::dependencies::is_flatpak() {\n        return Err(anyhow!(\n            \"yt-dlp is provided by the Flatpak runtime and cannot be updated from inside the app\"\n        ));\n    }\n    let path = download_ytdlp_binary().await?;\n    reset_ytdlp_cache();\n    Ok(path)\n}\n\n#[derive(Debug, Clone, Copy, PartialEq, Eq)]\npub enum YtdlpChannel {\n    Stable,\n    Nightly,\n}\n\nfn ytdlp_channel() -> YtdlpChannel {\n    match std::env::var(\"OMNIGET_YTDLP_CHANNEL\") {\n        Ok(v) if v.trim().eq_ignore_ascii_case(\"nightly\") => YtdlpChannel::Nightly,\n        _ => YtdlpChannel::Stable,","sourceCodeStart":1762,"sourceCodeEnd":1798,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/ytdlp.rs#L1762-L1798","documentation":"`update_ytdlp` refuses to self-update when running inside a Flatpak sandbox. In Flatpak, yt-dlp comes from the runtime/extension, and replacing it from within the app would violate sandbox packaging, so the function returns this explanatory error and asks the user to update via Flatpak instead.","triggerScenarios":"Calling `update_ytdlp()` when `is_flatpak()` returns true, i.e. the app was installed as a Flatpak and the user (or UI) triggered the in-app update action.","commonSituations":"User clicks \"Update yt-dlp\" in a Flatpak install; an auto-update routine runs in a Flatpak environment; documentation mismatch where users expect in-app updates to work.","solutions":["Update yt-dlp through the Flatpak runtime/extension (e.g. `flatpak update`).","Update the app itself via `flatpak update <app-id>` so its yt-dlp dependency is refreshed.","Hide or disable the in-app update button when running under Flatpak.","If self-managing yt-dlp is required, install the non-Flatpak build of the app."],"exampleFix":"// before\nif is_flatpak() { update_ytdlp().await?; }\n// after\nif is_flatpak() { eprintln!(\"update yt-dlp via 'flatpak update'\"); } else { update_ytdlp().await?; }","handlingStrategy":"validation","validationCode":"if crate::core::dependencies::is_flatpak() {\n    // skip in-app update; direct user to 'flatpak update'\n} else {\n    update_ytdlp().await?;\n}","typeGuard":"fn can_self_update_ytdlp() -> bool {\n    !crate::core::dependencies::is_flatpak()\n}","tryCatchPattern":"match update_ytdlp().await {\n    Err(e) if e.to_string().contains(\"Flatpak runtime\") => {\n        // inform user to run 'flatpak update' instead\n    }\n    other => other?,\n}","preventionTips":["Gate the update UI on is_flatpak().","Teach users that Flatpak installs are updated via flatpak.","Check for updates at the Flatpak level in app startup."],"tags":["flatpak","update-not-supported","yt-dlp","sandbox","linux"],"backgroundTag":"unsupported-operation","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"}