{"record":{"id":"5bba9f35f57666de","repo":"hasura/graphql-engine","slug":"s-is-not-a-directory-w","errorCode":null,"errorMessage":"'%s' is not a directory: %w","messagePattern":"'(.+?)' is not a directory: %w","errorType":"exception","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"cli/directory.go","lineNumber":55,"sourceCode":"\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\n\treturn nil\n}\n\n// filesRequired are the files that are mandatory to qualify for a project\n// directory.\nvar filesRequired = []string{\n\t\"config.yaml\",","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/directory.go#L37-L73","documentation":"The execution path exists and is stat-able, but it is a regular file (or otherwise not a directory). The message formats the base name of the path. Note the wrapped err is stale here — it is nil at this point, so the '%w' verb renders '%!w(<nil>)'.","triggerScenarios":"Passing a path that resolves to a file (e.g. pointing --dir at config.yaml itself or a script) so that ed.IsDir() is false in validateDirectory.","commonSituations":"Users pointing the directory flag at a file instead of its parent folder; copy-paste of a full file path from docs; glob or variable expansion that yields a file path.","solutions":["Change the directory argument to the parent folder containing config.yaml, not the file itself","Add a preflight check in scripts: [ -d \"$DIR\" ] || exit 1","If the wrapped '%!w(<nil>)' output confused you, ignore it — the real issue is the non-directory path"],"exampleFix":"# before\nmycli --dir ./project/config.yaml run\n# after\nmycli --dir ./project run","handlingStrategy":"validation","validationCode":"info, err := os.Stat(projectDir)\nif err != nil {\n    log.Fatal(err)\n}\nif !info.IsDir() {\n    log.Fatalf(\"%s is a file; pass its parent directory instead\", projectDir)\n}","typeGuard":"func isDirectory(p string) bool {\n    info, err := os.Stat(p)\n    return err == nil && info.IsDir()\n}","tryCatchPattern":"if err := ec.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"is not a directory\") {\n        // point --dir at the folder containing config.yaml\n    }\n}","preventionTips":["In scripts, gate with [ -d \"$DIR\" ]","Construct the directory from filepath.Dir(configPath) when deriving from a file path","Beware that the wrapped error in this message is nil and renders as %!w(<nil>)"],"tags":["filesystem","not-a-directory","validation","go"],"backgroundTag":"not-a-directory","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}