{"record":{"id":"14b8d4693cac1b25","repo":"hasura/graphql-engine","slug":"failed-to-find-a-temporary-director-w","errorCode":null,"errorMessage":"failed to find a temporary director: %w","messagePattern":"failed to find a temporary director: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/plugins/move.go","lineNumber":224,"sourceCode":"\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(\n\t\t\top,\n\t\t\tfmt.Errorf(\"could not rename/copy directory %q to %q: %w\", tmp, installDir, err),\n\t\t)\n\t}\n","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/plugins/move.go#L206-L242","documentation":"moveToInstallDir stages files through a temp dir created with os.MkdirTemp(\"\", \"hasura-temp-move\"); creation failed. The system temp directory (TMPDIR) is missing, unwritable, or exhausted (inode/space limits).","triggerScenarios":"os.MkdirTemp cannot create a directory in TMPDIR: TMPDIR points to a nonexistent/unwritable path, /tmp is mounted noexec/read-only for the user, or disk/inodes are full.","commonSituations":"Containers with tiny or read-only /tmp; TMPDIR misconfigured in CI; shared host with /tmp cleanup daemons; disk full during plugin install.","solutions":["Check TMPDIR/TEMP/TMP env vars point to an existing writable directory","Verify space and inodes on the temp filesystem (df -h /tmp; df -i /tmp)","Fix permissions on /tmp or remount it writable","Set TMPDIR to a roomier writable location and retry the install"],"exampleFix":"# before\nTMPDIR=/nonexistent hasura plugins install p\n# after\nmkdir -p ~/tmp && TMPDIR=~/tmp hasura plugins install p","handlingStrategy":"validation","validationCode":"tmp := os.Getenv(\"TMPDIR\")\nif tmp == \"\" { tmp = \"/tmp\" }\nif fi, err := os.Stat(tmp); err != nil || !fi.IsDir() {\n    return errors.New(\"TMPDIR invalid; set a writable temp dir\")\n}","typeGuard":null,"tryCatchPattern":"if err := installPlugin(p); err != nil && strings.Contains(err.Error(), \"temporary director\") {\n    // set TMPDIR to a writable location and retry\n}","preventionTips":["In containers, ensure /tmp exists, is writable, and has space","Set TMPDIR explicitly in CI environments","Monitor /tmp usage for large plugin installs"],"tags":["go","filesystem","temp-dir","permissions"],"backgroundTag":"tmpdir-creation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}