{"record":{"id":"db6255fe6b3a77a8","repo":"hasura/graphql-engine","slug":"failed-to-move-files-w","errorCode":null,"errorMessage":"failed to move files: %w","messagePattern":"failed to move files: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/plugins/move.go","lineNumber":229,"sourceCode":"// 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\n\treturn nil\n}\n\n// renameOrCopy will try to rename a dir or file. If rename is not supported, a manual copy will be performed.\n// Existing files at \"to\" will be deleted.","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/plugins/move.go#L211-L247","documentation":"moveToInstallDir wraps a moveAllFiles failure while moving the extracted archive into the temp staging directory. The underlying cause is one of the per-operation errors (400–410): glob issues, path-policy rejections, mkdir, or rename failures, now relative to the temp dir.","triggerScenarios":"Any FileOperations entry fails while being applied from srcDir into the freshly created temp dir — bad glob, traversal-blocked path, or filesystem error on the temp filesystem.","commonSituations":"Manifest/archive drift (To/From mismatch); read-only or full TMPDIR filesystem blocking writes into the staging dir; permissions on the extracted archive.","solutions":["Unwrap and address the underlying move error (see 400–410)","Ensure TMPDIR is writable with space (cf. error 412's fixes)","Fix or refresh the plugin manifest/index entries","Retry install after correcting the environment"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if fi, err := os.Stat(tmpBase); err != nil || !fi.UserWritable() { return errors.New(\"staging dir unwritable\") }","typeGuard":null,"tryCatchPattern":"if err := moveToInstallDir(...); err != nil && strings.Contains(err.Error(), \"failed to move files\") {\n    // unwrap: resolve underlying move error (glob/perm/space) before retry\n}","preventionTips":["Keep TMPDIR writable with enough space for the archive contents","Pre-validate manifests to avoid mid-staging failures"],"tags":["go","wrapper","plugin-install","temp-dir"],"backgroundTag":"plugin-file-move-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}