You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: PythonUvBuilder:CopyDependencies fails when sam build --cached deletes .aws-sam/build/<FunctionName> #864
PythonUvBuilder:CopyDependencies fails with [Errno 2] No such file or directory: '.aws-sam/build/<FunctionName>' when invoked from sam build --cached --beta-features. The cached-build path removes the build output directory but CopyDependencies expects it to already exist.
Destructive failure mode: the failed invocation also wipes .aws-sam/build/ for all functions, so users must sam build --beta-features from scratch to recover.
# Any SAM project with 2+ Python functions using python-uv builder
sam build --beta-features # succeeds
sam build --cached --beta-features # fails — also wipes prior .aws-sam/build/
Observed result
Starting Build use cache
Building codeuri: /path/to/src/my_function runtime: python3.14 architecture: arm64 functions: MyFunction
Auto-detected manifest file: /path/to/src/my_function/pyproject.toml
Running PythonUvBuilder:CleanUp
Running PythonUvBuilder:ResolveDependencies
Building Python dependencies using UV
Found uv.lock alongside pyproject.toml - using lock-based build for precise dependencies
Building from UV lock file
Running PythonUvBuilder:CopyDependencies
Build Failed
Error: PythonUvBuilder:CopyDependencies - [Errno 2] No such file or directory: '/path/to/.aws-sam/build/MyFunction'
.aws-sam/build.toml: every function entry has manifest_hash = "", so cache-decision logic routes through CopyDependencies against a non-existent target dir.
Expected result
sam build --cached --beta-features reuses cached deps when manifest unchanged; only re-copies source. Build dir recreated before CopyDependencies runs. No destructive state-loss on failure.
Notes
sam build --beta-features (no --cached): works
sam build --parallel --beta-features (no --cached): works
sam build --cached --parallel --beta-features: same failure
Environment
Reproduced 2026-04-26:
SAM CLI: 1.158.0
aws-lambda-builders: shipped with sam-cli 1.158.0
Python: 3.14
uv: 0.11.7
OS: macOS 26.3 (aarch64-apple-darwin)
Opened #870 with a fix: CopyDependenciesAction had its source/destination swapped, and UvRunner.install_requirements passed a relative --target through to uv (which runs with cwd=project_dir, so deps landed under the source dir). PR fixes both, with regression coverage in test_workflow.py, test_packager.py, and the existing dependencies_dir integration test.
Activity
tomaDev commentedon May 13, 2026
Opened #870 with a fix:
CopyDependenciesActionhad its source/destination swapped, andUvRunner.install_requirementspassed a relative--targetthrough touv(which runs withcwd=project_dir, so deps landed under the source dir). PR fixes both, with regression coverage intest_workflow.py,test_packager.py, and the existingdependencies_dirintegration test.