{"record":{"id":"2976b26eb60a592b","repo":"anomalyco/sst","slug":"failed-to-copy-synced-dependencies-w","errorCode":null,"errorMessage":"failed to copy synced dependencies: %w","messagePattern":"failed to copy synced dependencies: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/build.go","lineNumber":649,"sourceCode":"\t\treturn nil, fmt.Errorf(\"failed to parse properties: %w\", err)\n\t}\n\n\treturn &props, nil\n}\n\nfunc installDependenciesForLambda(ctx context.Context, input *runtime.BuildInput, projectInfo *projectInfo, architecture string) error {\n\tif err := copySourceFilesSimple(input, projectInfo); err != nil {\n\t\treturn fmt.Errorf(\"failed to copy source files: %w\", err)\n\t}\n\n\t// Container builds: Dockerfile handles deps; zip builds: install here\n\tif input.IsContainer {\n\t\tif err := copyWorkspacePackagesForContainer(input, projectInfo); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to copy workspace packages for container: %w\", err)\n\t\t}\n\t} else {\n\t\tif err := copySyncedDependencies(ctx, input, projectInfo, architecture); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to copy synced dependencies: %w\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// copyWorkspacePackagesForContainer copies workspace package directories into the artifact\n// so the Dockerfile's `uv pip install -r requirements.txt` can resolve relative paths.\nfunc copyWorkspacePackagesForContainer(input *runtime.BuildInput, projectInfo *projectInfo) error {\n\tworkspaceRoot := findWorkspaceRoot(projectInfo)\n\n\trequirementsPath := filepath.Join(input.Out(), \"requirements.txt\")\n\tcontent, err := os.ReadFile(requirementsPath)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tlines := strings.Split(string(content), \"\\n\")","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L631-L667","documentation":"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.","triggerScenarios":"copySyncedDependencies fails: previously synced dependency directory missing or unreadable, destination not writable, architecture mismatch leaving no synced artifacts to copy, or disk full.","commonSituations":"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.","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"],"exampleFix":"// before: architecture changed in config, stale synced deps for other arch\nnew sst.aws.PythonFunction(\"Fn\", { architecture: \"arm64\" })\n// after: force fresh sync for the new architecture\nrm -rf .sst\nsst deploy   # re-syncs and copies deps for arm64","handlingStrategy":"retry","validationCode":"arch := \"arm64\" // must match sst.config.ts architecture\nsyncedDir := filepath.Join(projectRoot, \".sst\", \"deps\", arch)\nif fi, err := os.Stat(syncedDir); err != nil || !fi.IsDir() {\n\tlog.Fatalf(\"no synced deps for %s — run deploy/dev to sync first\", arch)\n}","typeGuard":"func syncedDepsPresent(root, arch string) bool {\n\tfi, err := os.Stat(filepath.Join(root, \".sst\", arch))\n\treturn err == nil && fi.IsDir()\n}","tryCatchPattern":"var lastErr error\nfor i := 0; i < 2; i++ {\n\tif err := deploy(); err == nil { break }\n\telse if strings.Contains(err.Error(), \"failed to copy synced dependencies\") {\n\t\tos.RemoveAll(\".sst\") // clear stale synced artifacts, then resync\n\t\tlastErr = err\n\t\tcontinue\n\t}\n\tlastErr = err\n}\nif lastErr != nil { log.Fatal(lastErr) }","preventionTips":["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"],"tags":["filesystem","python","dependencies","lambda","build"],"backgroundTag":"file-copy-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}