GoogleContainerTools/skaffold · error
listing files: %w
Error message
listing files: %w
What it means
filemon.Stat computes modification times for a set of files by invoking the supplied deps() callback to obtain the file list. This error wraps any failure of that callback, meaning the dependency list itself could not be produced (e.g. a glob or workspace walk failed). Without a file list, no mtimes can be computed and file watching is skipped for that iteration.
Source
Thrown at pkg/skaffold/filemon/changes.go:38
"context"
"fmt"
"os"
"sort"
"strings"
"time"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/output/log"
)
// FileMap is a map of filename to modification times.
type FileMap map[string]time.Time
// Stat returns the modification times for a list of files.
func Stat(deps func() ([]string, error)) (FileMap, error) {
state := FileMap{}
paths, err := deps()
if err != nil {
return state, fmt.Errorf("listing files: %w", err)
}
for _, path := range paths {
stat, err := os.Stat(path)
if err != nil {
if os.IsNotExist(err) {
log.Entry(context.TODO()).Debugf("could not stat dependency: %s", err)
continue // Ignore files that don't exist
}
return nil, fmt.Errorf("unable to stat file %q: %w", path, err)
}
state[path] = stat.ModTime()
}
return state, nil
}
type Events struct {
Added []stringView on GitHub (pinned to a1189de023)
Solutions
- Check that all source/dependency directories referenced by your skaffold config exist and are readable.
- Fix glob patterns in artifact dependencies (invalid or unmatched patterns in the resolver).
- Re-run with debug logging to identify which dependency resolver's deps() failed and correct the underlying path/permission problem.
Defensive patterns
Strategy: try-catch
Validate before calling
for _, dir := range watchDirs {
if info, err := os.Stat(dir); err != nil || !info.IsDir() {
return fmt.Errorf("watch root %s missing or not a directory", dir)
}
} Try / catch
mtimes, err := filemon.Stat(deps)
if err != nil {
if strings.Contains(err.Error(), "listing files") {
log.Warnf("dependency listing failed, skipping watch cycle: %v", err)
return nil // degrade gracefully instead of aborting dev loop
}
return err
} Prevention
- Keep watch roots on always-available local filesystems
- Validate glob patterns in artifact dependencies at config load time
- Ensure source directories remain readable for the process user
When it happens
Trigger: Calling Stat with a deps function whose underlying implementation returns an error — e.g. filepath.Glob matching errors, io/fs Walk failures, unreadable source directories, or kubectl/context resolution failures in dependency resolvers.
Common situations: Watch roots deleted or unmounted during a dev session; source directories with permission errors; bad glob patterns in skaffold config artifacts; dependencies pointing to paths on disconnected network drives.
Related errors
- walking %q: %w
- CONFIG_MULTI_IMPORT_PROFILE_CONFLICT_ERR
- errStr (aggregated event log file errors, e.g. "eventV2 log
- writing build output to file: %w
- writing %q to %q: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/1cd8d45ec13c418d.
Report an issue: GitHub.