{"record":{"id":"bc18ef63471f7b24","repo":"pbakaus/impeccable","slug":"cannot-create-zipfilename-provider-directory-n","errorCode":null,"errorMessage":"Cannot create ${zipFileName}: provider directory not found: ${providerDir}","messagePattern":"Cannot create (.+?): provider directory not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/zip.js","lineNumber":25,"sourceCode":" */\n\nimport path from 'path';\nimport { createWriteStream, existsSync, statSync } from 'fs';\n// archiver v8 is ESM and exports format-specific classes (no factory function).\nimport { ZipArchive } from 'archiver';\n\n/**\n * Create ZIP file for a provider directory\n * @param {string} providerDir - Path to provider directory\n * @param {string} distDir - Path to dist directory\n * @param {string} providerName - Name of the provider\n */\nexport async function createProviderZip(providerDir, distDir, providerName) {\n  const zipFileName = `${providerName}.zip`;\n  const zipPath = path.join(distDir, zipFileName);\n\n  if (!existsSync(providerDir)) {\n    throw new Error(`Cannot create ${zipFileName}: provider directory not found: ${providerDir}`);\n  }\n\n  // Fail loud, never soft. This artifact ships to `npx impeccable skills\n  // install` via the bundle endpoint; a build that can't produce a real zip\n  // must exit non-zero rather than deploy an empty one. (archiver v8's ESM\n  // break previously failed here silently and shipped a 0-byte universal.zip.)\n  let entryCount = 0;\n  await new Promise((resolve, reject) => {\n    const output = createWriteStream(zipPath);\n    const archive = new ZipArchive({ zlib: { level: 9 } });\n\n    output.on('close', resolve);\n    output.on('error', reject);\n    archive.on('error', reject);\n    archive.on('entry', () => { entryCount += 1; });\n\n    archive.pipe(output);\n    archive.glob('**/*', {","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/scripts/lib/zip.js#L7-L43","documentation":"Thrown by createProviderZip() when the provider source directory does not exist on disk before archiving. The zip is an install artifact consumed by `npx impeccable skills install`, so the build refuses to produce a bundle from a missing source rather than ship a broken package.","triggerScenarios":"Calling createProviderZip with a providerDir path that does not exist — typically dist/universal missing because the universal provider stage never ran; passing a provider name whose stage was skipped in the build pipeline.","commonSituations":"A custom build script calls createProviderZip before the universal directory is generated; a refactor renamed the provider output directory but not the createAllZips caller; CI that pruned empty dist subdirs.","solutions":["Ensure the provider stage that populates providerDir (e.g. the universal stage writing dist/universal) runs before createProviderZip.","Verify the printed providerDir path exists with `ls`; fix the path or generate the directory.","Run `bun run build` which orders the stages correctly."],"exampleFix":"// before\nawait createProviderZip(path.join(distDir, 'universal'), distDir, 'universal');\n// but distDir/universal was never created\n\n// after — ensure the universal stage runs first\nawait stageUniversalProvider(distDir);\nawait createProviderZip(path.join(distDir, 'universal'), distDir, 'universal');","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nif (!existsSync(providerDir)) {\n  throw new Error(`Stage the provider directory first: ${providerDir}`);\n}","typeGuard":"function providerDirReady(providerDir) {\n  return existsSync(providerDir);\n}","tryCatchPattern":"try {\n  await createProviderZip(providerDir, distDir, providerName);\n} catch (err) {\n  if (/provider directory not found/.test(err.message)) {\n    console.error('Run the provider stage before zipping:', providerDir);\n  } else throw err;\n}","preventionTips":["Always run the provider stage before the zip stage in build scripts.","Assert the directory exists in a preflight check with a clear message.","Use `bun run build` which orders the stages correctly."],"tags":["build","zip","missing-dir","provider","release"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}