serverless/serverless · error · ServerlessError

ESBULD_PACKAGE_ALL_ERROR

ESBULD_PACKAGE_ALL_ERROR

Error message

${err.message}

What it means

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.

Source

Thrown at packages/serverless/lib/plugins/esbuild/index.js:2904

    ].sort((a, b) =>
      a.zipPath < b.zipPath ? -1 : a.zipPath > b.zipPath ? 1 : 0,
    )
    // Only service-level patterns apply here: a single shared zip has no
    // per-function view to narrow, so function-level patterns are ignored
    // without `individually` — same as classic packaging.
    const patterns = this.serverless.service.package?.patterns ?? []
    const compiledPatterns = compilePatterns(patterns)

    let patternCounters
    try {
      patternCounters = await this._writeArchive({
        zipPath,
        entries,
        compiledPatterns,
      })
    } catch (err) {
      if (err instanceof ServerlessError) throw err
      throw new ServerlessError(err.message, 'ESBULD_PACKAGE_ALL_ERROR')
    }
    patternCounters.excludedEntryCount += excludedServiceIncludeCount

    this.serverless.service.package.artifact = zipPath

    // Counters are only final once the output stream closed, which
    // `_writeArchive` already awaited.
    this._reportPatternFiltering({
      zipName,
      subject: zipName,
      compiledPatterns,
      ...patternCounters,
      buildProperties,
      declaredDependencyCount: await this._declaredDependencyCount(),
    })

    await this._assertHandlersInArtifact(
      functions,

View on GitHub (pinned to ba6ba66c01)

Solutions

  1. Read err.message for the underlying cause (often a specific unreadable file)
  2. Fix or remove the problem file/symlink in node_modules or included paths
  3. Check disk space and write permissions for the output zip
  4. Clean the build directory and rerun packaging
Defensive patterns

Strategy: try-catch

Validate before calling

import { accessSync, constants } from 'fs'
// ensure deps and build dir are readable before the combined zip
accessSync('node_modules', constants.R_OK)
accessSync('.serverless', constants.R_OK)

Try / catch

try {
  await packageAll()
} catch (e) {
  if (e.code === 'ESBULD_PACKAGE_ALL_ERROR') {
    console.error('combined-artifact packaging failed:', e.message)
  }
  throw e
}

Prevention

When it happens

Trigger: 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`.

Common situations: 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.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of serverless/serverless@ba6ba66c01 (2026-09-13). Data as JSON: /api/errors/a59bd18908d3ee80. Report an issue: GitHub.