{"record":{"id":"3d8e8ef61b8dddad","repo":"pbakaus/impeccable","slug":"created-zipfilename-but-it-is-0-bytes","errorCode":null,"errorMessage":"Created ${zipFileName} but it is 0 bytes.","messagePattern":"Created (.+?) but it is 0 bytes\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/zip.js","lineNumber":56,"sourceCode":"    output.on('error', reject);\n    archive.on('error', reject);\n    archive.on('entry', () => { entryCount += 1; });\n\n    archive.pipe(output);\n    archive.glob('**/*', {\n      cwd: providerDir,\n      dot: true,\n      ignore: ['**/.DS_Store'],\n    });\n    archive.finalize();\n  });\n\n  if (entryCount === 0) {\n    throw new Error(`Created ${zipFileName} but it contains no entries (source: ${providerDir}).`);\n  }\n  const { size } = statSync(zipPath);\n  if (size === 0) {\n    throw new Error(`Created ${zipFileName} but it is 0 bytes.`);\n  }\n\n  const sizeMB = (size / 1024 / 1024).toFixed(2);\n  console.log(`  📦 ${zipFileName} (${sizeMB} MB)`);\n}\n\n/**\n * Create ZIP files for all providers + universal\n * @param {string} distDir - Path to dist directory\n */\nexport async function createAllZips(distDir) {\n  console.log('\\n📦 Creating ZIP bundles...');\n\n  await createProviderZip(path.join(distDir, 'universal'), distDir, 'universal');\n}\n","sourceCodeStart":38,"sourceCodeEnd":72,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/scripts/lib/zip.js#L38-L72","documentation":"Thrown by createProviderZip() when the written zip file is 0 bytes despite archiver reporting entries. This is the regression guard for silent archiver failures (specifically the archiver v8 ESM break that produced a 0-byte universal.zip without throwing). It runs after the entry-count check passes.","triggerScenarios":"archiver.finalize() resolves and entryCount > 0 but the output stream wrote nothing to disk — archiver internal failure, a disk-full condition, an interrupted stream, or a bundler/ESM interop bug in archiver itself.","commonSituations":"A new archiver major version with an ESM/CJS interop regression; disk exhaustion during the write; a stream pipe setup error after a refactor of createProviderZip.","solutions":["Check available disk space and write permissions on distDir.","Pin or upgrade archiver to a known-good version (the comment cites v8's ESM break).","Reproduce with a minimal script; if archiver is the cause, file/upgrade the dependency."],"exampleFix":"// before — archiver v8 ESM regression writes 0 bytes silently\n\n// after — pin a known-good archiver and let the guard fail loud\n// package.json\n\"archiver\": \"^7.0.1\"","handlingStrategy":"validation","validationCode":"import { statSync } from 'node:fs';\nconst size = statSync(zipPath).size;\nif (size === 0) {\n  throw new Error('archiver produced 0 bytes; pin a known-good archiver version.');\n}","typeGuard":"function zipNonEmpty(zipPath) {\n  return existsSync(zipPath) && statSync(zipPath).size > 0;\n}","tryCatchPattern":"try {\n  await createProviderZip(providerDir, distDir, providerName);\n} catch (err) {\n  if (/0 bytes/.test(err.message)) {\n    console.error('archiver regression or disk issue; check archiver version and disk space.');\n  } else throw err;\n}","preventionTips":["Pin archiver to a known-good version; test the ESM import shape on upgrades.","Check disk space and write permissions before the release zip step.","Keep the 0-byte guard; it exists precisely to catch silent archiver failures."],"tags":["build","zip","regression-guard","archiver","release","dependency"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}