{"record":{"id":"2a5498609b3bc71e","repo":"vercel-labs/skills","slug":"zip-entry-checksum-mismatch","errorCode":null,"errorMessage":"Zip entry checksum mismatch","messagePattern":"Zip entry checksum mismatch","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/archive.ts","lineNumber":391,"sourceCode":"    }\n\n    const compressed = buffer.subarray(dataOffset, dataOffset + compressedSize);\n    let contents: Buffer;\n    if (method === 0) {\n      contents = compressed;\n    } else if (method === 8) {\n      contents = inflateRawSync(compressed, {\n        maxOutputLength: uncompressedSize + 1,\n      });\n    } else {\n      throw new Error(`Unsupported zip compression method: ${method}`);\n    }\n\n    if (contents.byteLength !== uncompressedSize) {\n      throw new Error('Zip entry size mismatch');\n    }\n    if (crc32(contents) !== expectedChecksum) {\n      throw new Error('Zip entry checksum mismatch');\n    }\n    files.set(fileName, new Uint8Array(contents));\n  }\n\n  if (offset !== centralDirectory.offset + centralDirectory.size) {\n    throw new Error('Invalid zip central directory size');\n  }\n\n  return files;\n}\n","sourceCodeStart":373,"sourceCodeEnd":402,"githubUrl":"https://github.com/vercel-labs/skills/blob/435076e78988e1e6ec40d00b0b1d76bdbbc5419a/src/archive.ts#L373-L402","documentation":"Thrown after successfully decompressing a zip entry when crc32(contents) does not equal the expectedChecksum from the zip header. CRC validation is the last integrity gate in readZipArchive; a mismatch means the bytes changed between what the archiver wrote and what was decompressed here. Almost always corruption in transit or on disk rather than a code bug.","triggerScenarios":"Extracting a zip whose entry bytes were altered/truncated after creation — interrupted downloads, corrupted cache, disk errors, or a server/proxy serving a truncated body that still parses as a valid zip structure.","commonSituations":"CI cache serving stale/corrupt zips, flaky networks truncating responses, partial uploads to a hosting provider, or mixing up offsets when zips are regenerated in place.","solutions":["Re-download the archive from the original source and retry extraction","Verify with unzip -t (or zip -T) to confirm the file is corrupt","Clear any local/CI cache holding the bad artifact","If the source archive itself is bad, regenerate it at the origin"],"exampleFix":"# before\nskills add https://example.com/skills.zip  # Zip entry checksum mismatch\n\n# after\nrm -rf ~/.cache/skills && skills add https://example.com/skills.zip","handlingStrategy":"validation","validationCode":"// Confirm CRC integrity before handing the file to the library\nimport { execFileSync } from 'node:child_process';\nfunction assertZipCrc(path: string): void {\n  execFileSync('unzip', ['-t', path], { stdio: 'pipe' });\n}","typeGuard":"null","tryCatchPattern":"try {\n  await extractArchive(file);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Zip entry checksum mismatch') {\n    await rm(file); // discard corrupt artifact, then re-download\n  } else throw err;\n}","preventionTips":["Cache downloads keyed by checksum so corrupt files are re-fetched","Avoid resuming downloads with naive byte appending; use range requests or restart"],"tags":["zip","crc32","checksum","corruption"],"backgroundTag":"checksum-verification-failed","analyzedSha":"435076e78988e1e6ec40d00b0b1d76bdbbc5419a","analyzedAt":"2026-08-28T17:47:53.369Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}