{"record":{"id":"52d76c10804d86d6","repo":"typst/typst","slug":"failed-to-download-asset-err","errorCode":null,"errorMessage":"failed to download asset ({err})","messagePattern":"failed to download asset \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/typst-cli/src/update.rs","lineNumber":177,"sourceCode":"    /// corresponding asset for this target platform, returning the raw binary\n    /// data.\n    pub fn download_binary(\n        &self,\n        asset_name: &str,\n        downloader: &dyn Downloader,\n    ) -> StrResult<Vec<u8>> {\n        let asset = self.assets.iter().find(|a| a.name.starts_with(asset_name)).ok_or(\n            eco_format!(\n                \"could not find prebuilt binary `{asset_name}` for your platform\"\n            ),\n        )?;\n\n        let data = match downloader.download(&\"release\", &asset.browser_download_url) {\n            Ok(data) => data,\n            Err(err) if err.kind() == io::ErrorKind::NotFound => {\n                bail!(\"asset not found (searched for {})\", asset.name);\n            }\n            Err(err) => bail!(\"failed to download asset ({err})\"),\n        };\n\n        if asset_name.contains(\"windows\") {\n            extract_binary_from_zip(&data, asset_name)\n        } else {\n            extract_binary_from_tar_xz(&data)\n        }\n    }\n}\n\n/// Extract the Typst binary from a ZIP archive.\nfn extract_binary_from_zip(data: &[u8], asset_name: &str) -> StrResult<Vec<u8>> {\n    let mut archive = ZipArchive::new(Cursor::new(data))\n        .map_err(|err| eco_format!(\"failed to extract ZIP archive ({err})\"))?;\n\n    let mut file =\n        archive.by_name(&format!(\"{asset_name}/typst.exe\")).map_err(|err| {\n            eco_format!(\"failed to extract Typst binary from ZIP archive ({err})\")","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/typst/typst/blob/35417aa769ab9d699a60384f91082b09bc6ba421/crates/typst-cli/src/update.rs#L159-L195","documentation":"From download_binary in the self-updater: the matching release asset was found, but downloading its archive from the browser_download_url failed (network error, interrupted transfer, unavailable CDN). The at-fault input is the asset download URL.","triggerScenarios":"Thrown at crates/typst-cli/src/update.rs:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the update after checking connectivity","Download the asset manually from the GitHub release page and install it","Try again later if GitHub's CDN is temporarily unavailable"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35417aa769ab9d699a60384f91082b09bc6ba421","analyzedAt":"2026-08-17T21:03:48.984Z","contentChangedAt":"2026-08-17T21:03:48.984Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}