{"record":{"id":"465407bdaeb0cb93","repo":"tonhowtf/omniget","slug":"engine-failed-mod","errorCode":null,"errorMessage":"Engine failed: {}","messagePattern":"Engine failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/bilibili/mod.rs","lineNumber":185,"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":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/bilibili/mod.rs#L167-L203","documentation":"In `api_engine_download` (src-tauri/src/platforms/bilibili/mod.rs:185), any failure returned by the Bilibili download engine (`engine::run_parsed_content`) is wrapped into an anyhow error with the message \"Engine failed: {}\" plus the engine error's i18n key. It is a top-level catch-all that funnels every engine-stage failure (playlist parsing, stream resolution, download/merge issues) into a single user-facing error.","triggerScenarios":"Any Err from `engine::run_parsed_content(&client, &parsed, &kind, &engine_opts, progress)` during a Bilibili download: engine could not resolve CDN streams, the media kind was unsupported, network fetches inside the engine failed, or the parsed content was unusable.","commonSituations":"Expired or missing Bilibili cookies for a members-only or region-locked video; Bilibili changing its playurl API shape so the engine can't extract streams; CDN hosts being unreachable; the ytdlp-parsed content lacking expected items.","solutions":["Read the i18n key embedded in the message to identify the underlying engine failure and address that root cause.","Refresh or reconfigure the Bilibili account cookies (slug) used by the API client, especially for paid/high-res content.","Toggle `bilibili_cdn_prefer_alternatives` / cdn_alt_hosts settings in case the preferred CDN is failing.","Update the app/engine code if Bilibili changed its API response format.","Retry the download after ruling out transient network issues."],"exampleFix":"// before\nlet result = engine::run_parsed_content(&client, &parsed, &kind, &engine_opts, progress)\n    .await\n    .map_err(|e| anyhow!(\"Engine failed: {}\", e.i18n_key()))?;\n// after\nlet result = engine::run_parsed_content(&client, &parsed, &kind, &engine_opts, progress)\n    .await\n    .map_err(|e| {\n        tracing::warn!(key = %e.i18n_key(), \"bilibili engine failed\");\n        anyhow!(\"Engine failed: {}\", e.i18n_key())\n    })?;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match engine::run_parsed_content(...).await {\n    Ok(result) => result,\n    Err(e) => {\n        tracing::warn!(key = %e.i18n_key(), \"bilibili engine failed\");\n        return Err(anyhow!(\"Engine failed: {}\", e.i18n_key()));\n    }\n}","preventionTips":["Keep Bilibili account cookies fresh and configured before downloading gated content.","Log the i18n key for every engine failure to build a failure taxonomy.","Pin and update CDN host settings when Bilibili changes its CDN infrastructure."],"tags":["rust","bilibili","download-engine","error-wrapping"],"backgroundTag":"api-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"}