{"record":{"id":"0d2967d049bc5c5e","repo":"hasura/graphql-engine","slug":"error-creating-directory-at-q-w","errorCode":null,"errorMessage":"error creating directory at %q: %w","messagePattern":"error creating directory at %q: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/plugins/move.go","lineNumber":219,"sourceCode":"\tfor _, fo := range fos {\n\t\terr := moveFiles(fromDir, toDir, fo)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"failed moving files: %w\", err))\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// moveToInstallDir moves plugins from srcDir to dstDir (created in this method) with given FileOperation.\nfunc moveToInstallDir(srcDir, installDir string, fos []FileOperation) error {\n\tvar op errors.Op = \"plugins.moveToInstallDir\"\n\n\tinstallationDir := filepath.Dir(installDir)\n\n\terr := os.MkdirAll(installationDir, 0o755)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"error creating directory at %q: %w\", installationDir, err))\n\t}\n\n\ttmp, err := os.MkdirTemp(\"\", \"hasura-temp-move\")\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"failed to find a temporary director: %w\", err))\n\t}\n\tdefer os.RemoveAll(tmp)\n\n\tif err = moveAllFiles(srcDir, tmp, fos); err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"failed to move files: %w\", err))\n\t}\n\n\tif err = renameOrCopy(tmp, installDir); err != nil {\n\t\tdefer func() {\n\t\t\tos.Remove(installDir)\n\t\t}()\n\n\t\treturn errors.E(","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/plugins/move.go#L201-L237","documentation":"moveToInstallDir creates the parent of the final install directory (e.g. {plugins}/{name}) with os.MkdirAll before staging the move, and that failed. Typical causes are permission denied, a blocking file at a path component, or a read-only filesystem.","triggerScenarios":"os.MkdirAll(filepath.Dir(installDir)) failing: unwritable plugins install root, an existing regular file where a directory is expected, or a read-only mount.","commonSituations":"HOME or XDG_DATA_HOME redirected to an unwritable path; running as a user without rights to the pre-existing plugins dir (created earlier by root/sudo); container with a read-only volume for the install path.","solutions":["Verify write access to the directory quoted in the error; chown -R or fix perms on the plugins root","Point HOME/XDG_DATA_HOME (or the CLI's path override) at a writable location","Delete any regular file occupying the directory path","If the dir was created by root earlier, either fix ownership or run consistently as one user"],"exampleFix":"# before\nsudo hasura plugins install my-plugin # root-owned dirs\n# after\nsudo chown -R $(id -u):$(id -g) ~/.local/share/hasura\nhasura plugins install my-plugin","handlingStrategy":"try-catch","validationCode":"if err := os.MkdirAll(filepath.Dir(installDir), 0o755); err != nil {\n    return fmt.Errorf(\"pre-check: cannot create install dir: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := installPlugin(p); err != nil {\n    var perr *fs.PathError\n    if errors.As(err, &perr) && os.IsPermission(perr) { /* chown/fix HOME, retry */ }\n}","preventionTips":["Pre-flight check writability of the plugins root","Set HOME/XDG_DATA_HOME to writable locations","Avoid running the CLI as root for plugin installs"],"tags":["go","filesystem","permissions","mkdir"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}