{"record":{"id":"28b45b291e83adca","repo":"hasura/graphql-engine","slug":"could-not-rename-copy-file-from-q-to-q-w","errorCode":null,"errorMessage":"could not rename/copy file from %q to %q: %w","messagePattern":"could not rename/copy file from %q to %q: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/plugins/move.go","lineNumber":190,"sourceCode":"\tmoves, err := findMoveTargets(fromDir, toDir, fo)\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"could not find move targets: %w\", err))\n\t}\n\n\tfor _, m := range moves {\n\t\terr := os.MkdirAll(filepath.Dir(m.to), 0o755)\n\t\tif err != nil {\n\t\t\treturn errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"failed to create move path %q: %w\", filepath.Dir(m.to), err),\n\t\t\t)\n\t\t}\n\n\t\terr = renameOrCopy(m.from, m.to)\n\t\tif err != nil {\n\t\t\treturn errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"could not rename/copy file from %q to %q: %w\", m.from, m.to, err),\n\t\t\t)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc moveAllFiles(fromDir, toDir string, fos []FileOperation) error {\n\tvar op errors.Op = \"plugins.moveAllFiles\"\n\n\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","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/plugins/move.go#L172-L208","documentation":"moveFiles calls renameOrCopy for each resolved move and the rename (with cross-device copy fallback) failed for one from→to pair. The wrapped error is the underlying os.Rename or copyTree failure.","triggerScenarios":"A per-file move failing: destination exists and cannot be removed, permission error on source or destination, cross-device rename where the copyTree fallback also fails (e.g. unreadable source file, disk full).","commonSituations":"Partial previous install left root-owned files; antivirus/locking on Windows; /tmp on a different device with the fallback copy hitting a full disk; file removed between glob and rename.","solutions":["Inspect the wrapped error for the OS-level cause (permission, ENOSPC, missing file)","Fix permissions or free disk space on the destination filesystem","Clean the plugin's install directory and re-run the install","If the source vanished (race), re-extract the archive / re-download and retry"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"for _, m := range moves {\n    if _, err := os.Lstat(m.from); err != nil { return fmt.Errorf(\"source vanished: %w\", err) }\n}","typeGuard":null,"tryCatchPattern":"if err := moveToInstallDir(...); err != nil && strings.Contains(err.Error(), \"rename/copy file\") {\n    // fix perms/space, remove partial install, retry install command once\n}","preventionTips":["Clean partial installs before re-running","Keep source (extracted archive) untouched until install finishes","Watch disk space for large plugin binaries"],"tags":["go","filesystem","rename","permissions"],"backgroundTag":"file-rename-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}