tonhowtf/omniget · error · anyhow::Error

Engine failed: {}

Error message

Engine failed: {}

What it means

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.

Solutions

  1. Read the i18n key embedded in the message to identify the underlying engine failure and address that root cause.
  2. Refresh or reconfigure the Bilibili account cookies (slug) used by the API client, especially for paid/high-res content.
  3. Toggle `bilibili_cdn_prefer_alternatives` / cdn_alt_hosts settings in case the preferred CDN is failing.
  4. Update the app/engine code if Bilibili changed its API response format.
  5. Retry the download after ruling out transient network issues.

Example fix

// before
let result = engine::run_parsed_content(&client, &parsed, &kind, &engine_opts, progress)
    .await
    .map_err(|e| anyhow!("Engine failed: {}", e.i18n_key()))?;
// after
let result = engine::run_parsed_content(&client, &parsed, &kind, &engine_opts, progress)
    .await
    .map_err(|e| {
        tracing::warn!(key = %e.i18n_key(), "bilibili engine failed");
        anyhow!("Engine failed: {}", e.i18n_key())
    })?;
Defensive patterns

Strategy: try-catch

Try / catch

match engine::run_parsed_content(...).await {
    Ok(result) => result,
    Err(e) => {
        tracing::warn!(key = %e.i18n_key(), "bilibili engine failed");
        return Err(anyhow!("Engine failed: {}", e.i18n_key()));
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/465407bdaeb0cb93. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/bilibili/mod.rs:185

        } else {
            preview::AUDIO_AUTO
        },
        embed_cover: settings.download.embed_thumbnail,
        keep_streams: false,
        filename,
        cancel: opts.cancel_token.clone(),
        danmaku_enabled: settings.download.bilibili_danmaku_enabled,
        danmaku_format: Some(danmaku_format),
        nfo_enabled: settings.download.bilibili_nfo_enabled,
        cover_sidecar_enabled: settings.download.bilibili_cover_sidecar,
        cover_format,
        cdn_alt_hosts,
        cdn_prefer_alternatives: settings.download.bilibili_cdn_prefer_alternatives,
    };

    let result = engine::run_parsed_content(&client, &parsed, &kind, &engine_opts, progress)
        .await
        .map_err(|e| anyhow!("Engine failed: {}", e.i18n_key()))?;

    Ok(DownloadResult {
        file_path: result.final_path,
        file_size_bytes: result.bytes,
        duration_seconds: parsed
            .items
            .first()
            .and_then(|i| i.duration_seconds)
            .unwrap_or(0.0),
        torrent_id: None,
    })
}

fn build_api_client(
    slug: Option<&str>,
    user_agent: Option<&str>,
) -> anyhow::Result<api::ApiClient> {
    let mut client =

View on GitHub (pinned to 8600b91f42)