tonhowtf/omniget · error

Spawn blocking failed

Error message

Spawn blocking failed: {}

What it means

install() unzips the downloaded Real-ESRGAN release in a tokio::task::spawn_blocking closure calling github::unpack. If the JoinHandle resolves to a JoinError (task panicked or was cancelled), the error is wrapped as 'Spawn blocking failed: {}'. Note the extra `?` afterwards also propagates any unpack IO error unwrapped.

Solutions

  1. Re-run the install — a transient download corruption is the most common cause
  2. Check the inner panic message after the colon to identify the failing step in github::unpack
  3. Verify network integrity: re-download and validate the asset size/checksum before unpacking
  4. Ensure the tokio runtime is not being shut down while the install is in flight
Defensive patterns

Strategy: retry

Try / catch

match upscale::install(&progress).await {
    Err(e) if e.to_string().starts_with("Spawn blocking failed") => {
        // panic in unpack: retry once after re-download
        upscale::install(&progress).await?;
    }
    other => other,
}

Prevention

When it happens

Trigger: The blocking task panics inside github::unpack (e.g. zip parsing panic on a corrupt archive) or the runtime shuts down/cancels the task before completion.

Common situations: Corrupt or truncated zip download; GitHub release asset changed format; runtime dropping during app shutdown mid-install; OOM during decompression.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/upscale.rs:91

        "macos"
    } else {
        "ubuntu"
    };
    name.starts_with("realesrgan-ncnn-vulkan") && name.contains(os) && name.ends_with(".zip")
}

pub async fn install(progress: super::ProgressFn) -> anyhow::Result<String> {
    let dir = managed_dir().ok_or_else(|| anyhow!("Could not determine data directory"))?;
    let client = github::client()?;
    let asset = github::asset(&client, REPO, None, asset_pick).await?;
    // Release de 2022: a API não tem digest para esses assets.
    let data = github::download(&client, &asset, true, &progress, BIN).await?;
    let staging = dir.with_extension("new");
    let _ = std::fs::remove_dir_all(&staging);
    let (s2, n2) = (staging.clone(), asset.name.clone());
    tokio::task::spawn_blocking(move || github::unpack(&data, &n2, &s2))
        .await
        .map_err(|e| anyhow!("Spawn blocking failed: {}", e))??;
    let Some(exe) = github::find_file(&staging, &bin_name(BIN)) else {
        let _ = std::fs::remove_dir_all(&staging);
        return Err(anyhow!("o pacote nao contem o {}", BIN));
    };
    github::make_executable(&exe);
    github::swap_dir(&staging, &dir)?;
    github::strip_quarantine(&dir).await;
    locate()
        .map(|p| p.to_string_lossy().to_string())
        .ok_or_else(|| anyhow!("binario sumiu apos instalar"))
}

#[derive(Debug, Clone, Deserialize)]
pub struct UpscaleOptions {
    pub inputs: Vec<String>,
    #[serde(default = "default_model")]
    pub model: String,
    #[serde(default = "default_scale")]

View on GitHub (pinned to 8600b91f42)