{"record":{"id":"68329c6f455b9ef1","repo":"tonhowtf/omniget","slug":"engine-failed","errorCode":null,"errorMessage":"Engine failed: {}","messagePattern":"Engine failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/platforms/bilibili/mod.rs","lineNumber":307,"sourceCode":"        } else {\n            preview::AUDIO_AUTO\n        },\n        embed_cover: settings.download.embed_thumbnail,\n        keep_streams: false,\n        filename,\n        cancel: opts.cancel_token.clone(),\n        danmaku_enabled: settings.download.bilibili_danmaku_enabled,\n        danmaku_format: Some(danmaku_format),\n        nfo_enabled: settings.download.bilibili_nfo_enabled,\n        cover_sidecar_enabled: settings.download.bilibili_cover_sidecar,\n        cover_format,\n        cdn_alt_hosts,\n        cdn_prefer_alternatives: settings.download.bilibili_cdn_prefer_alternatives,\n    };\n\n    let result = engine::run_parsed_content(&client, &parsed, &kind, &engine_opts, progress)\n        .await\n        .map_err(|e| anyhow!(\"Engine failed: {}\", e.i18n_key()))?;\n\n    Ok(DownloadResult {\n        file_path: result.final_path,\n        file_size_bytes: result.bytes,\n        duration_seconds: parsed\n            .items\n            .first()\n            .and_then(|i| i.duration_seconds)\n            .unwrap_or(0.0),\n        torrent_id: None,\n    })\n}\n\nfn build_api_client(\n    slug: Option<&str>,\n    user_agent: Option<&str>,\n) -> anyhow::Result<api::ApiClient> {\n    let mut client =","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/platforms/bilibili/mod.rs#L289-L325","documentation":"api_engine_download() hands the parsed content to engine::run_parsed_content, which performs the actual download/mux. Any engine failure is wrapped as 'Engine failed: {i18n_key}'. This is the download/mux execution stage: network I/O, CDN fetch, ffmpeg muxing, or danmaku/cover handling can all surface here.","triggerScenarios":"download() -> api_engine_download() where engine::run_parsed_content returns Err: CDN download failures, expired stream URLs, ffmpeg/mux errors, disk write failures, or user cancellation propagated from the engine.","commonSituations":"Bilibili CDN rejecting requests (missing referer/UA, region mismatch); ffmpeg not installed or wrong version; disk full or no write permission; unstable network mid-download.","solutions":["Read the embedded i18n_key to identify the stage (network vs mux vs IO) and fix that specifically.","Verify ffmpeg is installed and on PATH if the key points to muxing.","Check disk space and write permissions for the output directory.","Retry the download; CDN failures are often transient — re-fetch info to get fresh URLs."],"exampleFix":"// before\n.map_err(|e| anyhow!(\"Engine failed: {}\", e.i18n_key()))?;\n// after\n.map_err(|e| anyhow!(\"Engine failed: {} (stage: {:?})\", e.i18n_key(), e.stage()))?;","handlingStrategy":"retry","validationCode":"// pre-flight checks before download\nassert!(which(\"ffmpeg\").is_ok(), \"ffmpeg must be installed\");\nassert!(free_space(output_dir)? > required_bytes, \"insufficient disk space\");","typeGuard":null,"tryCatchPattern":"match download(url).await {\n    Err(e) if e.to_string().contains(\"Engine failed\") => {\n        match classify_stage(&e) {\n            Stage::Network => retry_with_backoff(url, 3).await,\n            Stage::Mux => verify_ffmpeg_and_retry(url).await,\n            _ => report(e),\n        }\n    }\n    other => other,\n}","preventionTips":["Install and verify ffmpeg on PATH before downloading.","Check disk space and output-directory write permissions.","Retry transient CDN failures and re-fetch info to get fresh stream URLs.","Read the embedded i18n_key to target the failing stage."],"tags":["bilibili","download-engine","mux","network"],"backgroundTag":"http-request-failed","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"}