{"record":{"id":"2983d2fc2563fd74","repo":"BoundaryML/baml","slug":"zip-archive-error-0","errorCode":null,"errorMessage":"zip archive error: {0}","messagePattern":"zip archive error: (.+?)","errorType":"exception","errorClass":"FetchError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_release/src/lib.rs","lineNumber":103,"sourceCode":"    #[error(\"manifest 404 for version {version} (not released yet?)\")]\n    ManifestNotFound { version: String },\n    #[error(\"manifest schema {got} not supported (max {max}); run `baml self-update`\")]\n    ManifestSchemaTooNew { got: u32, max: u32 },\n    #[error(\"target {target} not built for version {version}\")]\n    TargetNotInManifest { target: String, version: String },\n    #[error(\"sha256 mismatch for {url}: expected {expected}, got {got}\")]\n    ChecksumMismatch {\n        url: String,\n        expected: String,\n        got: String,\n    },\n    #[error(\"archive missing expected binary {name}\")]\n    BinaryNotInArchive { name: String },\n    #[error(\"archive contains unsafe path {path}\")]\n    UnsafeArchivePath { path: String },\n    #[error(\"disk error: {0}\")]\n    Io(#[from] std::io::Error),\n    #[error(\"zip archive error: {0}\")]\n    Zip(#[from] zip::result::ZipError),\n}\n\n#[derive(Debug, Clone)]\npub struct Fetcher {\n    pub spec: ReleaseSpec,\n    pub product: Product,\n    pub manifest_base_url: String,\n    pub release_repo: String,\n    artifact: Option<Artifact>,\n}\n\nimpl Fetcher {\n    pub fn default_for(spec: ReleaseSpec, product: Product) -> Self {\n        Self {\n            spec,\n            product,\n            manifest_base_url: manifest_base_url(),","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_release/src/lib.rs#L85-L121","documentation":"FetchError::Zip wraps a zip::result::ZipError raised while reading or extracting a downloaded BAML release archive. The library converts the underlying zip crate error via #[from], so any corrupt, truncated, or unsupported archive surfaces as \"zip archive error: {0}\". It indicates the fetched artifact could not be decompressed, not that the download itself failed.","triggerScenarios":"Calling download/extract paths in baml_release (e.g. the Fetcher flow) on bytes that are not a valid ZIP: truncated download, HTML error page saved as archive, unsupported compression method, or password-protected entry.","commonSituations":"Corporate proxy returning an error page instead of the release asset; interrupted download leaving a partial file; CDN corruption; manually edited or re-saved archive; very old zip features unsupported by the zip crate version.","solutions":["Delete the cached/partial archive and re-download the release to rule out truncation.","Verify the URL returned a real zip asset (check for proxy/HTML error pages in the file header).","Run `file`/unzip manually on the archive to confirm integrity.","Check the archive's compression method is one supported by the bundled zip crate version."],"exampleFix":"// before: blindly extract whatever was downloaded\nextract(&archive_bytes, dest)?;\n// after: sanity-check the archive before extraction\nif !archive_bytes.starts_with(b\"PK\") {\n    return Err(FetchError::Io(std::io::Error::new(\n        std::io::ErrorKind::InvalidData,\n        \"downloaded artifact is not a zip archive; re-download\",\n    )));\n}\nextract(&archive_bytes, dest)?;","handlingStrategy":"try-catch","validationCode":"if bytes.len() < 4 || !bytes.starts_with(b\"PK\") {\n    return Err(\"downloaded artifact is not a zip archive\".into());\n}","typeGuard":null,"tryCatchPattern":"match fetch_and_extract() {\n    Err(FetchError::Zip(e)) => { re_download_and_retry(); }\n    Err(other) => return Err(other),\n    Ok(v) => v,\n}","preventionTips":["Always verify the download length/checksum before extracting.","Detect proxy/HTML error pages (check magic bytes) before treating bytes as an archive.","Use resumable, verified downloads to avoid truncation."],"tags":["zip","archive","download","self-update"],"backgroundTag":"invalid-argument-format","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}