anomalyco/sst · error
failed to write filtered requirements file: %w
Error message
failed to write filtered requirements file: %w
What it means
After removing editable-install lines, filterEditableInstalls writes the filtered content with os.WriteFile(outputPath, ..., 0644) (build.go:1042). If the write fails — unwritable directory, full disk, path is a directory, or permission denied — this wrapped error is returned and dependency installation aborts before uv runs.
Source
Thrown at pkg/runtime/python/build.go:1045
}
if strings.HasPrefix(line, "-e ") {
editablePath := strings.TrimSpace(strings.TrimPrefix(line, "-e "))
if strings.HasPrefix(editablePath, "./") || strings.HasPrefix(editablePath, "../") ||
strings.HasPrefix(editablePath, "/") && !strings.Contains(editablePath, "://") {
continue
}
}
// NON-editable local paths and boto3/botocore are handled downstream
filteredLines = append(filteredLines, originalLine)
}
// Write filtered requirements
filteredContent := strings.Join(filteredLines, "\n")
if err := os.WriteFile(outputPath, []byte(filteredContent), 0644); err != nil {
return fmt.Errorf("failed to write filtered requirements file: %w", err)
}
return nil
}
// cleanupInstalledDependencies removes __pycache__, .pyc files, .dist-info, test dirs,
// and boto3/botocore (Lambda provides them, saves ~22MB) unless user opts in.
func cleanupInstalledDependencies(targetDir string) error {
err := filepath.Walk(targetDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return nil // Continue walking despite errors
}
if path == targetDir {
return nil
}
if !info.IsDir() {View on GitHub (pinned to a0bd20f762)
Solutions
- Check the wrapped inner error for ENOSPC (disk full) / EACCES (permissions) and fix accordingly
- Ensure the directory containing outputPath exists and is writable by the build user
- Free disk space or raise runner disk quota, then re-run the deploy
- Verify container/volume mounts are not read-only (rw flag) and no MAC policy blocks writes
Example fix
// before: read-only mount in CI docker run -v $PWD:/app:ro sst deploy # write fails // after docker run -v $PWD:/app sst deploy
Defensive patterns
Strategy: validation
Validate before calling
// preflight: writable build dir and adequate disk before deploy
[ -w .sst ] || { echo ".sst not writable"; exit 1; }
[ "$(df -k . | awk 'NR==2{print $4}')" -gt 1048576 ] || echo "<1GB free, may fail" Prevention
- Mount CI workspaces read-write (not :ro) and run the build as a user with write access
- Monitor disk quotas on build runners
- Ensure the target output directory is created before writes (fresh checkouts)
- Verify no SELinux/AppArmor policy denies writes to the project directory
When it happens
Trigger: Specifically: os.WriteFile(outputPath) fails while filterEditableInstalls runs from copySyncedDependencies or its anonymous caller — the outputPath directory doesn't exist, is read-only, or disk is exhausted.
Common situations: Read-only workspace mounts in CI containers; disk quota exceeded on build runners; outputPath pointing at a path occupied by a directory; SELinux/AppArmor denying writes to the build dir.
Related errors
- failed to filter requirements: %w
- failed to read requirements file: %w
- default Python Dockerfile not found at %s: %w
- failed to move extracted package: %w
- failed to remove old directory: %w
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/d546c66d75d657ba.
Report an issue: GitHub.