{"record":{"id":"d5c7f3790198ce72","repo":"anomalyco/sst","slug":"failed-to-read-requirements-file-w","errorCode":null,"errorMessage":"failed to read requirements file: %w","messagePattern":"failed to read requirements file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/build.go","lineNumber":1013,"sourceCode":"\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\n\tfor _, line := range lines {\n\t\toriginalLine := line\n\t\tline = strings.TrimSpace(line)\n\n\t\t// Skip empty lines and comments\n\t\tif line == \"\" || strings.HasPrefix(line, \"#\") {\n\t\t\tfilteredLines = append(filteredLines, originalLine)\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(line, \"-e \") {\n\t\t\teditablePath := strings.TrimSpace(strings.TrimPrefix(line, \"-e \"))\n","sourceCodeStart":995,"sourceCodeEnd":1031,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L995-L1031","documentation":"filterEditableInstalls reads the (filtered) requirements.txt via os.ReadFile (build.go:1011) to strip editable (-e) local-path installs, which produce symlinks that break in Lambda. If the input file cannot be read — typically because it does not exist or is unreadable — this wrapped error is returned. It means the earlier step that was supposed to generate that requirements file did not produce it at the expected path.","triggerScenarios":"Specifically: os.ReadFile(inputPath) returns an error when filterEditableInstalls runs from copySyncedDependencies or its anonymous caller — e.g. the generated filtered requirements path was never created, was already deleted (note os.Remove(filteredRequirementsPath) at build.go:1003 removes it after use), or permissions deny reading.","commonSituations":"Running the build in a container/workspace where the relative requirements.txt path (e.g. ./vendored_sst references) doesn't resolve; a prior build step failed silently leaving no requirements file; file removed by a concurrent build sharing the workspace; read permissions on mounted volumes.","solutions":["Confirm the requirements file exists at the path reported in the wrapped ENOENT error","Check that an earlier generation step (pyproject/requirements export) succeeded — fix the root failure and rebuild","Avoid concurrent builds in the same workspace that could delete the filtered requirements file mid-run","Verify read permissions on the file and its directory, especially in containers or mounted volumes"],"exampleFix":"// before: workspace missing the generated file\nls .sst/functions/requirements.txt  # not found\n\n// after: clean and rebuild so requirements are regenerated\nrm -rf .sst && sst deploy","handlingStrategy":"validation","validationCode":"# ensure the requirements source exists before building\n[ -f requirements.txt ] || [ -f pyproject.toml ] || { echo \"no requirements source\"; exit 1; }\n# avoid deleting the workspace mid-build; do a clean rebuild if in doubt\n# rm -rf .sst && sst deploy","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit or delete files under .sst/ while a build is running","After failed builds, run a clean rebuild (rm -rf .sst) so intermediate files are regenerated","Keep workspace paths short and ASCII to avoid path-resolution issues in containers","Check volume mount flags (rw) in CI containers"],"tags":["python","requirements","file-not-found","build","filesystem"],"backgroundTag":"file-not-found","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}