hasura/graphql-engine · error · errors.Error
failed recursively find config.yaml: search stopped due to a
Error message
failed recursively find config.yaml: search stopped due to a possible infinite filesystem traversal at %s
What it means
recursivelyValidateDirectory walks upward from the start directory looking for the required files (config.yaml, migrations/, etc.). filepath.Dir eventually returns the same path it was given (at the filesystem root), which is used as a loop sentinel to stop the walk. Hitting it means the upward search exhausted the filesystem without finding the required files and cannot go further.
Source
Thrown at cli/directory.go:90
var filesRequired = []string{
"config.yaml",
}
// recursivelyValidateDirectory tries to parse 'startFrom' as a project
// directory by checking for the 'filesRequired'. If the parent of 'startFrom'
// (nextDir) is filesystem root, error is returned. Otherwise, 'nextDir' is
// validated, recursively.
func recursivelyValidateDirectory(startFrom string) (validDir string, err error) {
var op errors.Op = "cli.recursivelyValidateDirectory"
err = ValidateDirectory(startFrom)
if err != nil {
nextDir := filepath.Dir(startFrom)
// to catch error gracefully in loop situation
if nextDir == startFrom {
return "", errors.E(
op,
fmt.Errorf(
"failed recursively find config.yaml: search stopped due to a possible infinite filesystem traversal at %s",
nextDir,
),
)
}
err := CheckFilesystemBoundary(nextDir)
if err != nil {
return nextDir, errors.E(
op,
fmt.Errorf(
"cannot find [%s] | search stopped: %w",
strings.Join(filesRequired, ", "),
err,
),
)
}
View on GitHub (pinned to 724551b9ae)
Solutions
- cd into the project directory (the one containing config.yaml) before running the CLI
- Pass the correct directory explicitly via the directory flag
- Ensure config.yaml actually exists and is spelled correctly at the project root
Example fix
# before cd /tmp && mycli run # upward search reaches / # after cd ~/code/myproject && mycli run
Defensive patterns
Strategy: fallback
Validate before calling
if _, err := os.Stat(filepath.Join(cwd, "config.yaml")); err != nil {
// walk up ourselves with a limit, or require explicit --dir
log.Fatal("no config.yaml in cwd or ancestors; cd into the project or pass --dir")
} Try / catch
if err := ec.Validate(); err != nil {
if strings.Contains(err.Error(), "infinite filesystem traversal") {
// rerun from the project root or supply the directory explicitly
}
} Prevention
- Invoke the CLI from the project root in docs and scripts
- Set an explicit directory flag in automation instead of relying on discovery
- Keep config.yaml at a stable, well-known project root
When it happens
Trigger: recursivelyValidateDirectory starting from a directory whose entire ancestor chain up to / contains none of the required files, so filepath.Dir(startFrom) == startFrom at the root triggers the graceful stop.
Common situations: Running the CLI far away from the project root (e.g. in /tmp or $HOME) so the upward scan reaches / without finding config.yaml; a renamed or missing config.yaml breaking detection.
Related errors
- cannot find [%s] | search stopped: %w
- writing metadata to file: %w
- reading metadata file: %w
- error finding absolute path for project directory: %w
- did not find required directory. use 'init'?: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/ac0d700de0f224cc.
Report an issue: GitHub.