{"record":{"id":"1133d0076eff2f9a","repo":"hasura/graphql-engine","slug":"error-getting-directory-details-w","errorCode":null,"errorMessage":"error getting directory details: %w","messagePattern":"error getting directory details: %w","errorType":"exception","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"cli/directory.go","lineNumber":51,"sourceCode":"\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\n\treturn nil\n}\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/directory.go#L33-L69","documentation":"os.Stat on the execution directory returned an error other than not-exist (for example permission denied, or a path component that is a file). The CLI cannot inspect the directory's metadata, so validation aborts with this wrapped error.","triggerScenarios":"Calling Validate when the process lacks search/execute permission on a path component leading to ExecutionDirectory, or when stat fails due to I/O errors, dangling symlinks in the path, or SELinux/AppArmor denials.","commonSituations":"Running the CLI as a different user than the directory owner; restricted mount points or NFS stale handles; symlink loops or broken symlinks inside the path; hardened container security contexts.","solutions":["Check permissions along the whole path: namei -l /path/to/dir and fix with chmod/chown","Inspect the wrapped error text to identify whether it is EACCES, EIO, or a symlink issue","Repair or remove broken symlinks in the path and retry"],"exampleFix":"# before\nmycli --dir /srv/proj run   # EACCES\n# after\nsudo chown -R $USER:$USER /srv/proj && mycli --dir /srv/proj run","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(projectDir); err != nil && !stderrors.Is(err, fs.ErrNotExist) {\n    log.Fatalf(\"cannot inspect %s: %v (check permissions/mounts)\", projectDir, err)\n}","typeGuard":null,"tryCatchPattern":"if err := ec.Validate(); err != nil {\n    var pathErr *os.PathError\n    if stderrors.As(err, &pathErr) {\n        // inspect pathErr.Err for EACCES/EIO and remediate permissions or mounts\n    }\n}","preventionTips":["Grant the running user search permission on every path component (namei -l)","Avoid running the tool with mismatched users via sudo","Monitor mounts/NFS health in the deployment environment"],"tags":["filesystem","permissions","stat","go"],"backgroundTag":"permission-denied","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}