{"record":{"id":"3e10cde1e1a2fe38","repo":"hasura/graphql-engine","slug":"did-not-find-required-directory-use-init-w","errorCode":null,"errorMessage":"did not find required directory. use 'init'?: %w","messagePattern":"did not find required directory\\. use 'init'\\?: %w","errorType":"exception","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"cli/directory.go","lineNumber":48,"sourceCode":"\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"error getting current working directory: %w\", err))\n\t\t}\n\n\t\tec.ExecutionDirectory = cwd\n\t} else {\n\t\tec.ExecutionDirectory, err = filepath.Abs(ec.ExecutionDirectory)\n\t\tif err != nil {\n\t\t\treturn errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"error finding absolute path for project directory: %w\", err),\n\t\t\t)\n\t\t}\n\t}\n\n\ted, err := os.Stat(ec.ExecutionDirectory)\n\tif err != nil {\n\t\tif stderrors.Is(err, fs.ErrNotExist) {\n\t\t\treturn errors.E(op, fmt.Errorf(\"did not find required directory. use 'init'?: %w\", err))\n\t\t}\n\n\t\treturn errors.E(op, fmt.Errorf(\"error getting directory details: %w\", err))\n\t}\n\n\tif !ed.IsDir() {\n\t\treturn errors.E(op, fmt.Errorf(\"'%s' is not a directory: %w\", ed.Name(), err))\n\t}\n\t// config.yaml\n\t// migrations/\n\t// (optional) metadata.yaml\n\tdir, err := recursivelyValidateDirectory(ec.ExecutionDirectory)\n\tif err != nil {\n\t\treturn errors.E(\"validate: %w\", err)\n\t}\n\n\tec.ExecutionDirectory = dir\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/directory.go#L30-L66","documentation":"validateDirectory stats the resolved execution directory and this error fires when os.Stat returns fs.ErrNotExist. It means the directory the CLI was told to operate on simply does not exist on disk, and the message hints the project may not have been scaffolded yet.","triggerScenarios":"Calling Validate with an ExecutionDirectory path that does not exist on the filesystem, e.g. a typo'd --dir flag, a project never created with the 'init' command, or a volume not mounted in a container.","commonSituations":"Forgetting to run the init command first; typos or stale relative paths in scripts/CI; Docker volume or Kubernetes PVC not mounted at the expected path; running from the wrong checkout.","solutions":["Run the tool's init command to scaffold the project directory before validating","Double-check the path passed via the directory flag/config for typos or wrong relative base","If in a container, confirm the volume/workdir is mounted and the path matches"],"exampleFix":"# before\nmycli --dir ./myproj run   # myproj does not exist\n# after\nmycli init && mycli --dir ./myproj run","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(projectDir); stderrors.Is(err, fs.ErrNotExist) {\n    log.Fatalf(\"project directory %s missing; run 'init' first\", projectDir)\n}","typeGuard":null,"tryCatchPattern":"if err := ec.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"did not find required directory\") {\n        // scaffold the project or fix the path, then retry\n    }\n}","preventionTips":["Run 'init' before any command that validates the project","Assert directory existence in CI before invoking the CLI","Canonicalize paths once at script start to catch typos early"],"tags":["filesystem","directory-not-found","validation","go"],"backgroundTag":"path-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}