anomalyco/sst · error
failed to copy synced dependencies: %w
Error message
failed to copy synced dependencies: %w
What it means
For zip (non-container) builds, installDependenciesForLambda copies synced/pre-installed dependencies for the target Lambda architecture into the output via copySyncedDependencies. Failure here means the dependency artifacts could not be staged into the build output.
Source
Thrown at pkg/runtime/python/build.go:649
return nil, fmt.Errorf("failed to parse properties: %w", err)
}
return &props, nil
}
func installDependenciesForLambda(ctx context.Context, input *runtime.BuildInput, projectInfo *projectInfo, architecture string) error {
if err := copySourceFilesSimple(input, projectInfo); err != nil {
return fmt.Errorf("failed to copy source files: %w", err)
}
// Container builds: Dockerfile handles deps; zip builds: install here
if input.IsContainer {
if err := copyWorkspacePackagesForContainer(input, projectInfo); err != nil {
return fmt.Errorf("failed to copy workspace packages for container: %w", err)
}
} else {
if err := copySyncedDependencies(ctx, input, projectInfo, architecture); err != nil {
return fmt.Errorf("failed to copy synced dependencies: %w", err)
}
}
return nil
}
// copyWorkspacePackagesForContainer copies workspace package directories into the artifact
// so the Dockerfile's `uv pip install -r requirements.txt` can resolve relative paths.
func copyWorkspacePackagesForContainer(input *runtime.BuildInput, projectInfo *projectInfo) error {
workspaceRoot := findWorkspaceRoot(projectInfo)
requirementsPath := filepath.Join(input.Out(), "requirements.txt")
content, err := os.ReadFile(requirementsPath)
if err != nil {
return nil
}
lines := strings.Split(string(content), "\n")View on GitHub (pinned to a0bd20f762)
Solutions
- Re-run the dependency sync/install step (deploy or dev) so synced artifacts are regenerated for the current architecture
- Ensure the architecture prop matches what was synced (consistent arm64/x86_64 across config and build)
- Fix permissions on the synced dependencies directory and build output
- Check disk space if the copy involves a large dependency tree
Example fix
// before: architecture changed in config, stale synced deps for other arch
new sst.aws.PythonFunction("Fn", { architecture: "arm64" })
// after: force fresh sync for the new architecture
rm -rf .sst
sst deploy # re-syncs and copies deps for arm64 Defensive patterns
Strategy: retry
Validate before calling
arch := "arm64" // must match sst.config.ts architecture
syncedDir := filepath.Join(projectRoot, ".sst", "deps", arch)
if fi, err := os.Stat(syncedDir); err != nil || !fi.IsDir() {
log.Fatalf("no synced deps for %s — run deploy/dev to sync first", arch)
} Type guard
func syncedDepsPresent(root, arch string) bool {
fi, err := os.Stat(filepath.Join(root, ".sst", arch))
return err == nil && fi.IsDir()
} Try / catch
var lastErr error
for i := 0; i < 2; i++ {
if err := deploy(); err == nil { break }
else if strings.Contains(err.Error(), "failed to copy synced dependencies") {
os.RemoveAll(".sst") // clear stale synced artifacts, then resync
lastErr = err
continue
}
lastErr = err
}
if lastErr != nil { log.Fatal(lastErr) } Prevention
- Keep architecture consistent across config changes; resync after switching arm64/x86_64
- Never delete .sst mid-build or while dev is running
- Ensure adequate free space for site-packages-sized copies
- Pin pip installs so syncs are reproducible
When it happens
Trigger: copySyncedDependencies fails: previously synced dependency directory missing or unreadable, destination not writable, architecture mismatch leaving no synced artifacts to copy, or disk full.
Common situations: Dev/deploys after switching architecture (arm64 vs x86_64) so synced artifacts don't match; running build before `sst dev`/install step ever synced dependencies; cleaning .sst while a build cache expected it; full disk when copying large site-packages.
Related errors
- failed to install dependencies: %w
- failed to copy dependencies to artifact: %w
- failed to move extracted package: %w
- failed to create output directory: %w
- failed to copy %s to %s: %w
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/2976b26eb60a592b.
Report an issue: GitHub.