{"record":{"id":"e7cacb7096f0c28b","repo":"anomalyco/sst","slug":"failed-to-create-deps-cache-directory-w","errorCode":null,"errorMessage":"failed to create deps cache directory: %w","messagePattern":"failed to create deps cache directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/build.go","lineNumber":861,"sourceCode":"\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}\n\t} else {\n\t\tdepsCacheDir = input.Out()\n\t}\n\n\t// Use --reinstall-package for workspace packages to bypass uv's stale cache\n\tworkspacePackages := getWorkspacePackageNames(projectInfo)\n\n\t// We use --reinstall-package (not --reinstall) to avoid re-fetching slow git dependencies\n\targs := []string{\"pip\", \"install\", \"-r\", requirementsPath, \"--target\", depsCacheDir}\n\n\tfor _, pkg := range workspacePackages {\n\t\targs = append(args, \"--reinstall-package\", pkg)\n\t}\n\n\t// Platform targeting for Lambda deployments (skip in dev mode and containers)\n\t// Skip if already on the target platform to use native cached wheels\n\tif !input.Dev && !input.IsContainer {","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L843-L879","documentation":"On a cache miss, SST creates the .deps/<hash>-<arch> cache directory with os.MkdirAll before running `uv pip install --target` into it. This error is returned when that directory cannot be created, wrapping the OS error. The .deps directory lives next to the build output, so failures usually come from permissions or a path collision.","triggerScenarios":"os.MkdirAll(depsCacheDir, 0755) fails when a file (not directory) already exists at a component of .deps/<cacheKey>, the parent output dir is read-only, or the disk is full.","commonSituations":"Previous build crash left a stray file named `.deps` or a cache-key path; switching users between builds (root-created .sst); read-only CI workspace; disk quota exceeded.","solutions":["Remove the stale `.deps` directory next to the build output: `rm -rf .sst/*/.deps` (or the path named in the wrapped error) and redeploy.","Fix ownership/permissions: `chown -R $USER .sst` so the current user can create directories.","Free disk space or raise the quota if the wrapped error is ENOSPC.","Ensure the deploy runs from a writable workspace (not a read-only mount)."],"exampleFix":"// before\nError: failed to copy synced dependencies: failed to create deps cache directory: mkdir /out/.deps/abc123-x86_64: not a directory\n// after\n$ rm -rf .sst   # or rm the stray file at the .deps path\n$ sst deploy","handlingStrategy":"validation","validationCode":"const depsRoot = path.join(path.dirname(buildOut), '.deps');\nif (fs.existsSync(depsRoot) && !fs.statSync(depsRoot).isDirectory()) throw new Error(`${depsRoot} is a file; remove it`);\nfs.accessSync(path.dirname(depsRoot), fs.constants.W_OK);","typeGuard":"null","tryCatchPattern":"try {\n  await deploy();\n} catch (e) {\n  if (/failed to create deps cache directory/.test(e.message)) {\n    fs.rmSync(path.join(path.dirname(buildOut), '.deps'), { recursive: true, force: true });\n    await deploy();\n  } else throw e;\n}","preventionTips":["Remove .deps cache after crashed/interrupted builds","Keep one owning user for the workspace and .sst output","Ensure free disk space before deploys","Never deploy from read-only mounted workspaces"],"tags":["filesystem","python","dependencies","cache"],"backgroundTag":"mkdir-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}