{"record":{"id":"a59bd18908d3ee80","repo":"serverless/serverless","slug":"esbuld-package-all-error","errorCode":"ESBULD_PACKAGE_ALL_ERROR","errorMessage":"${err.message}","messagePattern":"\\$\\{err\\.message\\}","errorType":"error_code","errorClass":"ServerlessError","httpStatus":null,"severity":"error","filePath":"packages/serverless/lib/plugins/esbuild/index.js","lineNumber":2904,"sourceCode":"    ].sort((a, b) =>\n      a.zipPath < b.zipPath ? -1 : a.zipPath > b.zipPath ? 1 : 0,\n    )\n    // Only service-level patterns apply here: a single shared zip has no\n    // per-function view to narrow, so function-level patterns are ignored\n    // without `individually` — same as classic packaging.\n    const patterns = this.serverless.service.package?.patterns ?? []\n    const compiledPatterns = compilePatterns(patterns)\n\n    let patternCounters\n    try {\n      patternCounters = await this._writeArchive({\n        zipPath,\n        entries,\n        compiledPatterns,\n      })\n    } catch (err) {\n      if (err instanceof ServerlessError) throw err\n      throw new ServerlessError(err.message, 'ESBULD_PACKAGE_ALL_ERROR')\n    }\n    patternCounters.excludedEntryCount += excludedServiceIncludeCount\n\n    this.serverless.service.package.artifact = zipPath\n\n    // Counters are only final once the output stream closed, which\n    // `_writeArchive` already awaited.\n    this._reportPatternFiltering({\n      zipName,\n      subject: zipName,\n      compiledPatterns,\n      ...patternCounters,\n      buildProperties,\n      declaredDependencyCount: await this._declaredDependencyCount(),\n    })\n\n    await this._assertHandlersInArtifact(\n      functions,","sourceCodeStart":2886,"sourceCodeEnd":2922,"githubUrl":"https://github.com/serverless/serverless/blob/ba6ba66c01ae3cbb5f6ae458ea12e3814b815ba0/packages/serverless/lib/plugins/esbuild/index.js#L2886-L2922","documentation":"Wrapper for failures while building the single all-functions archive: a non-ServerlessError thrown while zipping the whole build directory plus dependencies plus include patterns is rethrown as ESBULD_PACKAGE_ALL_ERROR with the original message. After success the service.package.artifact is set to the combined zip.","triggerScenarios":"Failure during the package-all zip run — same underlying causes as per-function packaging (I/O errors, stream failures, unreadable dependency files) but when producing the single combined artifact via `package: individually: false` / `serverless package`.","commonSituations":"node_modules containing unreadable/broken symlinks that the archiver chokes on; disk full when writing the large combined zip; a package pattern including an unreadable path.","solutions":["Read err.message for the underlying cause (often a specific unreadable file)","Fix or remove the problem file/symlink in node_modules or included paths","Check disk space and write permissions for the output zip","Clean the build directory and rerun packaging"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { accessSync, constants } from 'fs'\n// ensure deps and build dir are readable before the combined zip\naccessSync('node_modules', constants.R_OK)\naccessSync('.serverless', constants.R_OK)","typeGuard":null,"tryCatchPattern":"try {\n  await packageAll()\n} catch (e) {\n  if (e.code === 'ESBULD_PACKAGE_ALL_ERROR') {\n    console.error('combined-artifact packaging failed:', e.message)\n  }\n  throw e\n}","preventionTips":["npm ci fresh in CI to avoid broken symlinks or partially installed node_modules","Monitor disk space when producing large combined zips","Ensure every path pulled in by package patterns is readable","Rerun packaging after cleaning .serverless if the zip stream is corrupted"],"tags":["packaging","zip","filesystem"],"backgroundTag":"file-write-failed","analyzedSha":"ba6ba66c01ae3cbb5f6ae458ea12e3814b815ba0","analyzedAt":"2026-09-13T23:08:04.935Z","contentChangedAt":"2026-09-13T23:08:04.935Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}