hasura/graphql-engine · error

failed to move files: %w

Error message

failed to move files: %w

What it means

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.

Source

Thrown at cli/plugins/move.go:229

// moveToInstallDir moves plugins from srcDir to dstDir (created in this method) with given FileOperation.
func moveToInstallDir(srcDir, installDir string, fos []FileOperation) error {
	var op errors.Op = "plugins.moveToInstallDir"

	installationDir := filepath.Dir(installDir)

	err := os.MkdirAll(installationDir, 0o755)
	if err != nil {
		return errors.E(op, fmt.Errorf("error creating directory at %q: %w", installationDir, err))
	}

	tmp, err := os.MkdirTemp("", "hasura-temp-move")
	if err != nil {
		return errors.E(op, fmt.Errorf("failed to find a temporary director: %w", err))
	}
	defer os.RemoveAll(tmp)

	if err = moveAllFiles(srcDir, tmp, fos); err != nil {
		return errors.E(op, fmt.Errorf("failed to move files: %w", err))
	}

	if err = renameOrCopy(tmp, installDir); err != nil {
		defer func() {
			os.Remove(installDir)
		}()

		return errors.E(
			op,
			fmt.Errorf("could not rename/copy directory %q to %q: %w", tmp, installDir, err),
		)
	}

	return nil
}

// renameOrCopy will try to rename a dir or file. If rename is not supported, a manual copy will be performed.
// Existing files at "to" will be deleted.

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Unwrap and address the underlying move error (see 400–410)
  2. Ensure TMPDIR is writable with space (cf. error 412's fixes)
  3. Fix or refresh the plugin manifest/index entries
  4. Retry install after correcting the environment
Defensive patterns

Strategy: try-catch

Validate before calling

if fi, err := os.Stat(tmpBase); err != nil || !fi.UserWritable() { return errors.New("staging dir unwritable") }

Try / catch

if err := moveToInstallDir(...); err != nil && strings.Contains(err.Error(), "failed to move files") {
    // unwrap: resolve underlying move error (glob/perm/space) before retry
}

Prevention

When it happens

Trigger: 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.

Common situations: Manifest/archive drift (To/From mismatch); read-only or full TMPDIR filesystem blocking writes into the staging dir; permissions on the extracted archive.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/db6255fe6b3a77a8. Report an issue: GitHub.