{"record":{"id":"b817d13e1da0cdf7","repo":"anomalyco/sst","slug":"failed-to-copy-dependencies-to-artifact-w","errorCode":null,"errorMessage":"failed to copy dependencies to artifact: %w","messagePattern":"failed to copy dependencies to artifact: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/build.go","lineNumber":1000,"sourceCode":"\t\t\t\"pyprojectPath\", projectInfo.PyprojectPath)\n\t\tif cacheKey != \"\" {\n\t\t\tos.RemoveAll(depsCacheDir)\n\t\t}\n\t\treturn fmt.Errorf(\"failed to run uv pip install: %v\\n%s\\n\\nFunction: %s\\nHandler: %s\\nWorking directory: %s\\nPyproject path: %s\",\n\t\t\terr, string(installOutput), input.FunctionID, input.Handler, installWorkspaceDir, projectInfo.PyprojectPath)\n\t}\n\n\tif err := cleanupInstalledDependencies(depsCacheDir); err != nil {\n\t\tslog.Warn(\"failed to clean up installed dependencies\", \"error\", err)\n\t}\n\n\t// Precompile bytecode in the cache so all functions sharing these deps benefit\n\tif err := precompilePythonFiles(ctx, input, depsCacheDir); err != nil {\n\t\tslog.Warn(\"failed to precompile dependencies in cache\", \"error\", err)\n\t}\n\n\tif err := copyDependencyPackages(depsCacheDir, input.Out()); err != nil {\n\t\treturn fmt.Errorf(\"failed to copy dependencies to artifact: %w\", err)\n\t}\n\n\tos.Remove(filteredRequirementsPath)\n\n\treturn nil\n}\n\n// filterEditableInstalls removes editable (-e) local path installs from requirements.txt.\n// Editable installs create symlinks which won't work in Lambda.\nfunc filterEditableInstalls(inputPath, outputPath string) error {\n\tcontent, err := os.ReadFile(inputPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read requirements file: %w\", err)\n\t}\n\n\tlines := strings.Split(string(content), \"\\n\")\n\tvar filteredLines []string\n","sourceCodeStart":982,"sourceCodeEnd":1018,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L982-L1018","documentation":"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.","triggerScenarios":"Specifically: copyDependencyPackages returns an error after cleanupInstalledDependencies and precompilePythonFiles succeeded; copySyncedDependencies wraps it as `failed to copy dependencies to artifact: %w`.","commonSituations":"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.","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"],"exampleFix":"// before: concurrent builds corrupt the shared cache\nsst deploy & sst deploy &  # race on depsCacheDir\n\n// after: serialize builds or run once\nsst deploy  # wait for completion before next deploy","handlingStrategy":"retry","validationCode":"// preflight: disk space and output dir writability\ndf -h . | awk 'NR==2 {exit ($5+0 > 90 ? 1 : 0)}' || echo \"low disk\"\n[ -w .sst ] || echo \"build output dir not writable\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["build","filesystem","python","lambda","artifact"],"backgroundTag":"artifact-copy-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}