{"record":{"id":"fd3ee24147b77164","repo":"anomalyco/sst","slug":"timed-out-waiting-for-dependency-install-lock-afte","errorCode":null,"errorMessage":"timed out waiting for dependency install lock after 5 minutes","messagePattern":"timed out waiting for dependency install lock after 5 minutes","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/build.go","lineNumber":844,"sourceCode":"\t\tif !exists {\n\t\t\tcacheLock = &sync.Mutex{}\n\t\t\tglobalDependencyInstallLocks[cacheKey] = cacheLock\n\t\t}\n\t\tglobalDependencyInstallLocksMutex.Unlock()\n\n\t\t// Acquire lock with timeout (5 minutes)\n\t\tlockAcquired := make(chan struct{})\n\t\tgo func() {\n\t\t\tcacheLock.Lock()\n\t\t\tclose(lockAcquired)\n\t\t}()\n\t\tselect {\n\t\tcase <-lockAcquired:\n\t\t\t// got the lock\n\t\tcase <-ctx.Done():\n\t\t\treturn fmt.Errorf(\"context cancelled while waiting for dependency install lock\")\n\t\tcase <-time.After(5 * time.Minute):\n\t\t\treturn fmt.Errorf(\"timed out waiting for dependency install lock after 5 minutes\")\n\t\t}\n\t\tdefer cacheLock.Unlock()\n\n\t\t// Check disk cache\n\t\tif entries, err := os.ReadDir(depsCacheDir); err == nil && len(entries) > 0 {\n\t\t\tif err := copyDependencyPackages(depsCacheDir, input.Out()); err != nil {\n\t\t\t\tslog.Warn(\"failed to copy from disk cache, will reinstall\", \"error\", err)\n\t\t\t\t// Remove bad cache and continue to reinstall\n\t\t\t\tos.RemoveAll(depsCacheDir)\n\t\t\t} else {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\t// Cache miss - create the cache directory\n\t\tif err := os.MkdirAll(depsCacheDir, 0755); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create deps cache directory: %w\", err)\n\t\t}","sourceCodeStart":826,"sourceCodeEnd":862,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L826-L862","documentation":"SST guards the shared .deps dependency cache with a per-cache-key mutex and gives up after 5 minutes of waiting. This error means another build held the dependency-install lock for the same requirements hash + architecture for over 5 minutes — usually because a competing install is genuinely stuck or extremely slow (network fetch, hung uv process).","triggerScenarios":"time.After(5 * time.Minute) fires in copySyncedDependencies while cacheLock is held by another concurrent build of the same project with identical requirements and architecture.","commonSituations":"A parallel CI job hung on a slow/unreachable package index while holding the lock; a zombie `sst dev` process mid-install; very large dependency set taking >5 minutes to install while other functions wait.","solutions":["Find and kill the stuck build process holding the lock (locks are in-process): `ps aux | grep sst` and terminate the hung one, then redeploy.","Rerun the deploy — the second attempt may hit the now-populated .deps cache and skip the install.","If installs are legitimately slow, fix the underlying slowness (use a faster package index/mirror, reduce dependencies) so installs finish under 5 minutes.","Stagger CI jobs so they don't build the same project simultaneously."],"exampleFix":"// before\nError: failed to copy synced dependencies: timed out waiting for dependency install lock after 5 minutes\n// after\n$ pkill -f 'sst dev'   # kill hung process holding the lock\n$ sst deploy","handlingStrategy":"retry","validationCode":"// before deploying, ensure no other sst process is mid-install on this project\npgrep -f 'sst (deploy|dev)' || echo 'no competing builds'","typeGuard":"null","tryCatchPattern":"try {\n  await deploy();\n} catch (e) {\n  if (/timed out waiting for dependency install lock/.test(e.message)) {\n    killStuckSstProcess();     // lock is in-process, killing frees it\n    await deploy();            // second run may hit warm .deps cache\n  } else throw e;\n}","preventionTips":["Don't run parallel CI jobs building the same project concurrently","Use a fast/local package mirror so installs finish well under 5 minutes","Clean up hung sst processes before long deploys","Keep dependency lists lean to shrink install time"],"tags":["concurrency","python","dependencies","timeout"],"backgroundTag":"lock-acquisition-timeout","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}