anomalyco/sst · error

failed to process archive %s: %w

Error message

failed to process archive %s: %w

What it means

One matched archive file could not be extracted/cleaned by `processPackageArchive`. The original error from the zip/tar extraction, renaming, or move step is wrapped here along with the archive path.

Source

Thrown at pkg/runtime/python/build.go:302

	for _, pattern := range patterns {
		files, err = filepath.Glob(pattern)
		if err != nil {
			return fmt.Errorf("failed to find package archive: %w", err)
		}
		if len(files) > 0 {
			break
		}
	}

	if len(files) == 0 {
		return fmt.Errorf("no package archive found for %s (tried patterns: %s-*.whl, %s-*.tar.gz, %s-*.whl, %s-*.tar.gz)",
			pkg.Name, normalizedName, normalizedName, pkg.Name, pkg.Name)
	}

	// Process each archive file
	for _, archiveFile := range files {
		if err := processPackageArchive(archiveFile, outputDir); err != nil {
			return fmt.Errorf("failed to process archive %s: %w", archiveFile, err)
		}
	}

	return nil
}

// processPackageArchive extracts and cleans up a single package archive
func processPackageArchive(archiveFile, outputDir string) error {
	if strings.HasSuffix(archiveFile, ".whl") {
		if err := extractZip(archiveFile, outputDir); err != nil {
			return fmt.Errorf("failed to extract wheel: %w", err)
		}

		os.Remove(archiveFile)

		return nil
	}

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Delete the build output directory and rebuild so pip re-downloads a fresh archive
  2. Check available disk space and that outputDir is writable
  3. Inspect the specific archive path in the error message — try `unzip -t` or `tar -tzf` on it to confirm corruption
  4. Re-run `sst deploy`; transient network issues during pip download are a common cause

Example fix

// before: stale partial build artifacts
sst deploy
// after: clean rebuild
rm -rf .sst/build && sst deploy
Defensive patterns

Strategy: try-catch

Validate before calling

import { statSync } from "fs";
for (const f of archives) {
  const s = statSync(f);
  if (s.size === 0) throw new Error(`Archive ${f} is empty — rebuild`);
}

Try / catch

try {
  await buildPackage(...);
} catch (e) {
  if (String(e).includes("failed to process archive")) {
    console.error("Corrupt or unreadable archive — clean .sst/build and redeploy:", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: `extractAndProcessPackageArchive` iterates over files found by glob and calls `processPackageArchive`; extraction fails due to a corrupt/partial download, a truncated wheel, or a filesystem permission problem in outputDir.

Common situations: Interrupted pip download leaving a partial .whl; disk full during extraction; outputDir under a path with restrictive permissions or read-only mount; malicious/corrupted wheel file rejected by the zip reader.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/35142f729aa16a31. Report an issue: GitHub.