{"record":{"id":"46ad3d717372ad72","repo":"nektos/act","slug":"unable-to-filepath-walk-v","errorCode":null,"errorMessage":"Unable to filepath.Walk: %v","messagePattern":"Unable to filepath\\.Walk: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/exprparser/functions.go","lineNumber":217,"sourceCode":"\t\t}\n\t}\n\n\tmatcher := gitignore.NewMatcher(ps)\n\n\tvar files []string\n\tif err := filepath.Walk(impl.config.WorkingDir, func(path string, fi fs.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsansPrefix := strings.TrimPrefix(path, impl.config.WorkingDir+string(filepath.Separator))\n\t\tparts := strings.Split(sansPrefix, string(filepath.Separator))\n\t\tif fi.IsDir() || !matcher.Match(parts, fi.IsDir()) {\n\t\t\treturn nil\n\t\t}\n\t\tfiles = append(files, path)\n\t\treturn nil\n\t}); err != nil {\n\t\treturn \"\", fmt.Errorf(\"Unable to filepath.Walk: %v\", err)\n\t}\n\n\tif len(files) == 0 {\n\t\treturn \"\", nil\n\t}\n\n\thasher := sha256.New()\n\n\tfor _, file := range files {\n\t\tf, err := os.Open(file)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"Unable to os.Open: %v\", err)\n\t\t}\n\n\t\tif _, err := io.Copy(hasher, f); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"Unable to io.Copy: %v\", err)\n\t\t}\n","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/exprparser/functions.go#L199-L235","documentation":"Thrown by hashFiles() when a file matched by the patterns cannot be opened with os.Open — typically permission denied, the file vanished between walk and open, or it is a special file (socket, device).","triggerScenarios":"Broad patterns like '**' matching sockets in .git or runtime dirs; files unreadable by the act process; race with a concurrent build deleting outputs.","commonSituations":"hashFiles('**') instead of targeted patterns; running act as a different user than the file owner; node_modules or cache dirs with odd permissions.","solutions":["Narrow the pattern to the files you actually hash (e.g. 'src/**', '**/go.sum').","Fix read permissions or run act as the file owner.","Exclude problematic directories via more specific patterns."],"exampleFix":"# before\n${{ hashFiles('**') }}\n# after\n${{ hashFiles('**/package-lock.json', 'src/**') }}","handlingStrategy":"try-catch","validationCode":"func filesReadable(globs []string) bool {\n  for _, g := range globs {\n    m, _ := filepath.Glob(g)\n    for _, f := range m {\n      if fi, err := os.Stat(f); err == nil && fi.Mode().IsRegular() == false { return false }\n    }\n  }\n  return true\n}","typeGuard":null,"tryCatchPattern":"if _, err := hashFiles(p...); err != nil {\n  if strings.Contains(err.Error(), 'os.Open') {\n    p = filterToRegularFiles(p) // drop sockets/fifos, retry once\n  } else { return err }\n}","preventionTips":["Use targeted patterns instead of '**'","Avoid hashing dirs containing sockets/fifos (.git, run dirs)","Run act with read access to the whole workspace"],"tags":["expressions","hash-files","filesystem","permissions"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}