hasura/graphql-engine · error
could not rename/copy file from %q to %q: %w
Error message
could not rename/copy file from %q to %q: %w
What it means
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.
Source
Thrown at cli/plugins/move.go:190
moves, err := findMoveTargets(fromDir, toDir, fo)
if err != nil {
return errors.E(op, fmt.Errorf("could not find move targets: %w", err))
}
for _, m := range moves {
err := os.MkdirAll(filepath.Dir(m.to), 0o755)
if err != nil {
return errors.E(
op,
fmt.Errorf("failed to create move path %q: %w", filepath.Dir(m.to), err),
)
}
err = renameOrCopy(m.from, m.to)
if err != nil {
return errors.E(
op,
fmt.Errorf("could not rename/copy file from %q to %q: %w", m.from, m.to, err),
)
}
}
return nil
}
func moveAllFiles(fromDir, toDir string, fos []FileOperation) error {
var op errors.Op = "plugins.moveAllFiles"
for _, fo := range fos {
err := moveFiles(fromDir, toDir, fo)
if err != nil {
return errors.E(op, fmt.Errorf("failed moving files: %w", err))
}
}
return nilView on GitHub (pinned to 724551b9ae)
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
Defensive patterns
Strategy: retry
Validate before calling
for _, m := range moves {
if _, err := os.Lstat(m.from); err != nil { return fmt.Errorf("source vanished: %w", err) }
} Try / catch
if err := moveToInstallDir(...); err != nil && strings.Contains(err.Error(), "rename/copy file") {
// fix perms/space, remove partial install, retry install command once
} Prevention
- Clean partial installs before re-running
- Keep source (extracted archive) untouched until install finishes
- Watch disk space for large plugin binaries
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- rename exe to old: %w
- writing metadata to file: %w
- error getting directory details: %w
- write file: %w
- cannot create global config directory: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/28b45b291e83adca.
Report an issue: GitHub.