{"record":{"id":"05ea4f954e1317bf","repo":"hasura/graphql-engine","slug":"error-walking-the-directory-path-w","errorCode":null,"errorMessage":"error walking the directory path: %w","messagePattern":"error walking the directory path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/seed/apply.go","lineNumber":93,"sourceCode":"\t} else {\n\t\terr := afero.Walk(fs, seedsDirectory, func(path string, file os.FileInfo, err error) error {\n\t\t\tif file == nil || err != nil {\n\t\t\t\treturn errors.E(op, err)\n\t\t\t}\n\n\t\t\tif err := hasAllowedSeedFileExtensions(file.Name()); err == nil && !file.IsDir() {\n\t\t\t\tb, err := afero.ReadFile(fs, path)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.E(op, fmt.Errorf(\"error opening file: %w\", err))\n\t\t\t\t}\n\n\t\t\t\tsqlAsBytes = append(sqlAsBytes, b)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"error walking the directory path: %w\", err))\n\t\t}\n\t}\n\n\tvar args []hasura.RequestBody\n\n\tsourceKind := getSourceKind(source)\n\tswitch sourceKind {\n\tcase hasura.SourceKindPG:\n\t\tfor _, sql := range sqlAsBytes {\n\t\t\trequest := hasura.RequestBody{\n\t\t\t\tType: \"run_sql\",\n\t\t\t\tArgs: hasura.PGRunSQLInput{\n\t\t\t\t\tSQL:    string(sql),\n\t\t\t\t\tSource: source.Name,\n\t\t\t\t},\n\t\t\t}\n\t\t\targs = append(args, request)\n\t\t}","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/seed/apply.go#L75-L111","documentation":"When no explicit seed files are given, ApplySeedsToDatabase walks the entire seeds directory with afero.Walk; this error wraps any failure of that walk itself (not per-file read errors, which are reported separately). Typical causes are the seeds directory not existing or being unreadable.","triggerScenarios":"Running `hasura seed apply` (directory mode) when seedsDirectory does not exist, is a regular file instead of a directory, or a subdirectory inside it cannot be listed due to missing execute/read permission.","commonSituations":"The seeds/ folder was never created or was renamed (e.g. to database/seed/); directory permissions were tightened after copying the project; or a nested directory in seeds/ is owned by root from a Docker run.","solutions":["Confirm the seeds directory exists and is a directory: ls -ld <project>/seeds; create it with mkdir seeds if missing.","Fix directory permissions: chmod +rx on seeds/ and all subdirectories (find seeds -type d -exec chmod +rx {} +).","Check the config for a custom seeds_directory setting pointing at the wrong path.","Remove non-directory entries named 'seeds' and recreate the folder."],"exampleFix":"# before\n$ hasura seed apply\nerror walking the directory path: open ./seeds: no such file or directory\n\n# after\n$ mkdir -p seeds && echo 'CREATE TABLE t(id int);' > seeds/0-init.sql\n$ hasura seed apply","handlingStrategy":"validation","validationCode":"fi, err := os.Stat(seedsDirectory)\nif err != nil { /* create it or fix config */ }\nif !fi.IsDir() { return fmt.Errorf(\"%s is not a directory\", seedsDirectory) }\n// ensure subdirs are listable\nfilepath.WalkDir(seedsDirectory, func(p string, d fs.DirEntry, err error) error {\n    if err != nil { return err }\n    return nil\n})","typeGuard":"func isReadableDir(path string) bool {\n    fi, err := os.Stat(path)\n    return err == nil && fi.IsDir() && fi.Mode().Perm()&0o500 == 0o500\n}","tryCatchPattern":"if err := ApplySeedsToDatabase(...); err != nil && strings.Contains(err.Error(), \"error walking the directory path\") {\n    if errors.Is(err, fs.ErrNotExist) { os.MkdirAll(seedsDir, 0o755) /* retry */ }\n}","preventionTips":["Commit an empty seeds/ directory (with a .gitkeep) so clones always have it.","Double-check custom seeds_directory values in config.yaml.","Run find seeds -type d -exec chmod +rx {} + after permission changes."],"tags":["go","seeds","directory-walk","filesystem","hasura-cli"],"backgroundTag":"directory-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}