anomalyco/sst · error
failed to scan source files: %v
Error message
failed to scan source files: %v
What it means
Raised in syncPythonFiles (pkg/runtime/python/python.go:286) when filepath.Walk over the project root fails while collecting .py source files for artifact syncing in legacy workspace layouts. filepath.Walk reports errors for unreadable directories (permission denied) or files disappearing mid-walk, and the walk callback also propagates filepath.Rel failures.
Source
Thrown at pkg/runtime/python/python.go:286
// Skip hidden directories and common non-Python directories
if info.IsDir() {
if strings.HasPrefix(filepath.Base(path), ".") ||
strings.Contains(relPath, "node_modules") ||
strings.Contains(relPath, "__pycache__") {
return filepath.SkipDir
}
return nil
}
if strings.HasSuffix(path, ".py") {
sourceFiles[relPath] = info
}
return nil
})
if err != nil {
return fmt.Errorf("failed to scan source files: %v", err)
}
// Collect Python files in artifacts
artifactFiles := make(map[string]os.FileInfo)
if _, err := os.Stat(destDir); err == nil {
err = filepath.Walk(destDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
relPath, err := filepath.Rel(destDir, path)
if err != nil {
return err
}
if !info.IsDir() && strings.HasSuffix(path, ".py") {
artifactFiles[relPath] = info
}View on GitHub (pinned to a0bd20f762)
Solutions
- Read the wrapped error path: `chmod`/`chown` the named directory so the sst process can traverse it
- Ensure you run sst from the project root that still exists (no renamed/deleted folders mid-dev); restart `sst dev`
- Remove symlink loops or stale package/src/package remnants; avoid walking into .venv-like dirs with bad permissions
Example fix
// before sst dev -> failed to scan source files: open packages/api: permission denied // after sudo chown -R $(whoami) packages/api sst dev
Defensive patterns
Strategy: validation
Validate before calling
// verify project tree is readable before running dev/deploy
err := filepath.Walk(projectRoot, func(p string, info os.FileInfo, err error) error {
if err != nil { return fmt.Errorf("unreadable: %s: %v", p, err) }
return nil
})
if err != nil { fmt.Println("fix permissions before running sst:", err) } Try / catch
if err := syncPythonFiles(src, dst); err != nil {
if strings.Contains(err.Error(), "failed to scan source files") {
// rescan after fixing permissions/restart to avoid mid-walk races
return resyncAfterPermissionsFix()
}
return err
} Prevention
- Run sst as the same user that owns the project files (especially in Docker/CI)
- Avoid deleting/renaming directories while `sst dev` is syncing
- Break symlink loops; don't symlink .venv or caches into walked source trees
- On shared machines keep project dirs with chmod u+rwX
When it happens
Trigger: Project root or a subdirectory not readable by the sst process (permissions); a symlink loop or deleted directory during the walk; a file removed between listing and stat; filepath.Rel returning an error for a path not under srcDir.
Common situations: Docker container or CI running sst as a different user than the project owner; macOS/ Linux permission changes after syncing from another machine; editors/renames racing a live `sst dev` session on workspace-layout (package/src/package) Python projects.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- failed to walk extracted directory: %w
- failed to scan artifact files: %v
- failed to delete %s: %v
- failed to create directory for %s: %v
- failed to remove old directory: %w
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/57d3bc3f87c0c415.
Report an issue: GitHub.