anomalyco/sst · error
failed to copy dependencies to artifact: %w
Error message
failed to copy dependencies to artifact: %w
What it means
After a successful uv install, SST precompiles bytecode and then calls copyDependencyPackages(depsCacheDir, input.Out()) to materialize the installed site-packages into the build artifact (build.go:999). If that copy fails for any reason (missing cache dir, unreadable files, artifact output path problems), the error is wrapped with %w and returned. The dependency cache itself is intact — only the artifact assembly failed.
Source
Thrown at pkg/runtime/python/build.go:1000
"pyprojectPath", projectInfo.PyprojectPath)
if cacheKey != "" {
os.RemoveAll(depsCacheDir)
}
return fmt.Errorf("failed to run uv pip install: %v\n%s\n\nFunction: %s\nHandler: %s\nWorking directory: %s\nPyproject path: %s",
err, string(installOutput), input.FunctionID, input.Handler, installWorkspaceDir, projectInfo.PyprojectPath)
}
if err := cleanupInstalledDependencies(depsCacheDir); err != nil {
slog.Warn("failed to clean up installed dependencies", "error", err)
}
// Precompile bytecode in the cache so all functions sharing these deps benefit
if err := precompilePythonFiles(ctx, input, depsCacheDir); err != nil {
slog.Warn("failed to precompile dependencies in cache", "error", err)
}
if err := copyDependencyPackages(depsCacheDir, input.Out()); err != nil {
return fmt.Errorf("failed to copy dependencies to artifact: %w", err)
}
os.Remove(filteredRequirementsPath)
return nil
}
// filterEditableInstalls removes editable (-e) local path installs from requirements.txt.
// Editable installs create symlinks which won't work in Lambda.
func filterEditableInstalls(inputPath, outputPath string) error {
content, err := os.ReadFile(inputPath)
if err != nil {
return fmt.Errorf("failed to read requirements file: %w", err)
}
lines := strings.Split(string(content), "\n")
var filteredLines []string
View on GitHub (pinned to a0bd20f762)
Solutions
- Read the wrapped inner error (%w) to identify the exact failing file or path
- Free disk space and re-run the deploy — this is the most common cause
- Check filesystem permissions on the .sst build output and cache directories
- Run only one build at a time or isolate the deps cache if concurrent builds share it
- Retry the deploy; a fresh uv install will rebuild the cache
Example fix
// before: concurrent builds corrupt the shared cache sst deploy & sst deploy & # race on depsCacheDir // after: serialize builds or run once sst deploy # wait for completion before next deploy
Defensive patterns
Strategy: retry
Validate before calling
// preflight: disk space and output dir writability
df -h . | awk 'NR==2 {exit ($5+0 > 90 ? 1 : 0)}' || echo "low disk"
[ -w .sst ] || echo "build output dir not writable" Prevention
- Keep several GB free on the build disk; large dep trees inflate artifact copy size
- Don't run concurrent builds sharing the same .sst workspace/cache
- Exclude build/output dirs from antivirus/indexer scanning
- Retry the deploy once — the cache rebuilds cleanly
When it happens
Trigger: Specifically: copyDependencyPackages returns an error after cleanupInstalledDependencies and precompilePythonFiles succeeded; copySyncedDependencies wraps it as `failed to copy dependencies to artifact: %w`.
Common situations: Disk full or permissions issues on the build machine; the deps cache directory was removed concurrently by another build sharing the cache; antivirus/indexers locking files on macOS/Windows; symlinked entries in site-packages the copier cannot follow.
Related errors
- failed to copy synced dependencies: %w
- failed to move extracted package: %w
- failed to create output directory: %w
- failed to copy %s to %s: %w
- failed to install dependencies: %w
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/b817d13e1da0cdf7.
Report an issue: GitHub.