{"record":{"id":"603a4a8b6e2d1d93","repo":"tonhowtf/omniget","slug":"spawn-blocking-failed-upscale","errorCode":null,"errorMessage":"Spawn blocking failed: {}","messagePattern":"Spawn blocking failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/upscale.rs","lineNumber":91,"sourceCode":"        \"macos\"\n    } else {\n        \"ubuntu\"\n    };\n    name.starts_with(\"realesrgan-ncnn-vulkan\") && name.contains(os) && name.ends_with(\".zip\")\n}\n\npub async fn install(progress: super::ProgressFn) -> anyhow::Result<String> {\n    let dir = managed_dir().ok_or_else(|| anyhow!(\"Could not determine data directory\"))?;\n    let client = github::client()?;\n    let asset = github::asset(&client, REPO, None, asset_pick).await?;\n    // Release de 2022: a API não tem digest para esses assets.\n    let data = github::download(&client, &asset, true, &progress, BIN).await?;\n    let staging = dir.with_extension(\"new\");\n    let _ = std::fs::remove_dir_all(&staging);\n    let (s2, n2) = (staging.clone(), asset.name.clone());\n    tokio::task::spawn_blocking(move || github::unpack(&data, &n2, &s2))\n        .await\n        .map_err(|e| anyhow!(\"Spawn blocking failed: {}\", e))??;\n    let Some(exe) = github::find_file(&staging, &bin_name(BIN)) else {\n        let _ = std::fs::remove_dir_all(&staging);\n        return Err(anyhow!(\"o pacote nao contem o {}\", BIN));\n    };\n    github::make_executable(&exe);\n    github::swap_dir(&staging, &dir)?;\n    github::strip_quarantine(&dir).await;\n    locate()\n        .map(|p| p.to_string_lossy().to_string())\n        .ok_or_else(|| anyhow!(\"binario sumiu apos instalar\"))\n}\n\n#[derive(Debug, Clone, Deserialize)]\npub struct UpscaleOptions {\n    pub inputs: Vec<String>,\n    #[serde(default = \"default_model\")]\n    pub model: String,\n    #[serde(default = \"default_scale\")]","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/upscale.rs#L73-L109","documentation":"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.","triggerScenarios":"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.","commonSituations":"Corrupt or truncated zip download; GitHub release asset changed format; runtime dropping during app shutdown mid-install; OOM during decompression.","solutions":["Re-run the install — a transient download corruption is the most common cause","Check the inner panic message after the colon to identify the failing step in github::unpack","Verify network integrity: re-download and validate the asset size/checksum before unpacking","Ensure the tokio runtime is not being shut down while the install is in flight"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match upscale::install(&progress).await {\n    Err(e) if e.to_string().starts_with(\"Spawn blocking failed\") => {\n        // panic in unpack: retry once after re-download\n        upscale::install(&progress).await?;\n    }\n    other => other,\n}","preventionTips":["Validate the downloaded archive size/checksum before unpacking","Keep the tokio runtime alive until install completes (no mid-install shutdown)","Check the inner panic message to identify corruption in github::unpack"],"tags":["tokio","async","panic","installation","rust"],"backgroundTag":"thread-interrupted","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"}