{"record":{"id":"32a587772368b24a","repo":"hasura/graphql-engine","slug":"cannot-validate-directory-s-s-not-found","errorCode":null,"errorMessage":"cannot validate directory '%s': [%s] not found","messagePattern":"cannot validate directory '(.+?)': \\[(.+?)\\] not found","errorType":"exception","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"cli/directory.go","lineNumber":136,"sourceCode":"\tvar op errors.Op = \"cli.ValidateDirectory\"\n\n\tnotFound := []string{}\n\n\tfor _, f := range filesRequired {\n\t\tif _, err := os.Stat(filepath.Join(dir, f)); stderrors.Is(err, fs.ErrNotExist) {\n\t\t\trelpath, e := filepath.Rel(dir, f)\n\t\t\tif e == nil {\n\t\t\t\tf = relpath\n\t\t\t}\n\n\t\t\tnotFound = append(notFound, f)\n\t\t}\n\t}\n\n\tif len(notFound) > 0 {\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\n\t\t\t\t\"cannot validate directory '%s': [%s] not found\",\n\t\t\t\tdir,\n\t\t\t\tstrings.Join(notFound, \", \"),\n\t\t\t),\n\t\t)\n\t}\n\n\treturn nil\n}\n\n// CheckFilesystemBiundary returns an error if dir is filesystem root.\nfunc CheckFilesystemBoundary(dir string) error {\n\tvar op errors.Op = \"cli.CheckFilesystemBoundary\"\n\t// since filepath.Abs calls filepath.Clean the path is expected to be in \"clean\" state\n\tisWindowsRoot, _ := regexp.MatchString(`^[a-zA-Z]:\\\\$`, dir)\n\t// return error if filesystem boundary is hit\n\tif dir == \"/\" || isWindowsRoot {\n\t\treturn errors.E(op, \"filesystem boundary hit\")","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/directory.go#L118-L154","documentation":"ValidateDirectory checks that every required entry (config.yaml, migrations/, optional metadata.yaml) exists inside dir. When one or more are missing, it returns this error listing the missing names. It is the definitive 'your project layout is incomplete' signal from both InitRun and the recursive validator.","triggerScenarios":"Calling InitRun or recursivelyValidateDirectory on a directory that lacks config.yaml or the migrations/ folder; required files deleted, renamed, or never generated by init.","commonSituations":"Partial or interrupted 'init'; hand-created projects that skipped migrations/; renamed config.yaml (e.g. config.yml); fresh clone of a repo where required files are gitignored.","solutions":["Re-run the init command to regenerate the missing scaffolding","Create the missing entries listed in the error: touch config.yaml and mkdir migrations","Check for renames like config.yml vs config.yaml and correct the filename"],"exampleFix":"# before\n# dir has only migrations/\nmycli --dir ./proj run\n# after\ntouch ./proj/config.yaml && mycli --dir ./proj run","handlingStrategy":"validation","validationCode":"required := []string{\"config.yaml\", \"migrations\"}\nvar missing []string\nfor _, r := range required {\n    if _, err := os.Stat(filepath.Join(dir, r)); err != nil {\n        missing = append(missing, r)\n    }\n}\nif len(missing) > 0 {\n    log.Fatalf(\"missing required entries: %s\", strings.Join(missing, \", \"))\n}","typeGuard":null,"tryCatchPattern":"if err := cli.ValidateDirectory(dir); err != nil {\n    if strings.Contains(err.Error(), \"not found\") {\n        // parse the bracketed list, create/scaffold those entries, retry\n    }\n}","preventionTips":["Scaffold projects with init rather than by hand","Commit required files (ensure they aren't gitignored)","Validate layout in CI before deploy stages"],"tags":["validation","missing-files","project-layout","go"],"backgroundTag":"missing-required-file","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}