{"record":{"id":"1fd0c10825db0606","repo":"NousResearch/hermes-agent","slug":"corrupt-zip-bad-local-file-header","errorCode":null,"errorMessage":"Corrupt zip: bad local file header.","messagePattern":"Corrupt zip: bad local file header\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/vscode-marketplace.ts","lineNumber":255,"sourceCode":"    const nameLen = buf.readUInt16LE(offset + 28)\n    const extraLen = buf.readUInt16LE(offset + 30)\n    const commentLen = buf.readUInt16LE(offset + 32)\n    const localOffset = buf.readUInt32LE(offset + 42)\n    const name = buf.toString('utf8', offset + 46, offset + 46 + nameLen)\n\n    records.set(name, { method, compressedSize, localOffset })\n    offset += 46 + nameLen + extraLen + commentLen\n  }\n\n  return records\n}\n\n/** Inflate a single entry to a string. */\nfunction extractEntry(buf, record) {\n  // The local header's name/extra lengths can differ from the central record,\n  // so re-read them here to locate the compressed payload.\n  if (buf.readUInt32LE(record.localOffset) !== 0x04034b50) {\n    throw new Error('Corrupt zip: bad local file header.')\n  }\n\n  const nameLen = buf.readUInt16LE(record.localOffset + 26)\n  const extraLen = buf.readUInt16LE(record.localOffset + 28)\n  const dataStart = record.localOffset + 30 + nameLen + extraLen\n  const data = buf.subarray(dataStart, dataStart + record.compressedSize)\n\n  // 0 = stored, 8 = deflate. Theme files are one or the other.\n  return record.method === 0 ? data.toString('utf8') : zlib.inflateRawSync(data).toString('utf8')\n}\n\n/** Normalize a package.json theme path to its zip entry name. */\nfunction themeEntryName(themePath) {\n  const clean = String(themePath).replace(/^\\.\\//, '').replace(/^\\//, '')\n\n  return `extension/${clean}`\n}\n","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/apps/desktop/electron/vscode-marketplace.ts#L237-L273","documentation":"Error \"Corrupt zip: bad local file header.\" thrown in NousResearch/hermes-agent.","triggerScenarios":"Thrown at apps/desktop/electron/vscode-marketplace.ts:255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-download the package; the zip is corrupt.","Verify the downloaded file size/hash matches the Marketplace artifact.","Retry on a network path that does not rewrite or buffer binary downloads."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}