hasura/graphql-engine · error

failed to create move path %q: %w

Error message

failed to create move path %q: %w

What it means

During moveFiles, after move targets are resolved, os.MkdirAll on the parent directory of a destination file failed. This is a plain filesystem error: permission denied, a file existing where a directory is needed, read-only filesystem, or I/O failure.

Source

Thrown at cli/plugins/move.go:182

	_, okTo := IsSubPath(toBase, m.to)

	return okFrom && okTo
}

func moveFiles(fromDir, toDir string, fo FileOperation) error {
	var op errors.Op = "plugins.moveFiles"

	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"

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check permissions/ownership of the plugins install root (ls -la on the dir from the error message) and chown/chmod or sudo as appropriate
  2. Verify HOME / XDG_DATA_HOME (or HASURA_* path env vars) point to a writable location
  3. Remove any stale regular file blocking the directory path (rm the file named in the error)
  4. Ensure the volume is writable and has space; then retry the install

Example fix

# before: regular file blocking dir path
rm ~/.local/share/hasura/plugins/foo
# after
hasura plugins install foo-plugin
Defensive patterns

Strategy: try-catch

Validate before calling

if err := syscall.Access(filepath.Dir(destParent), unix.W_OK); err != nil {
    return errors.New("install dir not writable")
}

Try / catch

if err := moveToInstallDir(...); err != nil {
    var perr *fs.PathError
    if errors.As(err, &perr) && os.IsPermission(perr) { /* fix perms, retry */ }
}

Prevention

When it happens

Trigger: The install destination's parent dir cannot be created: no write permission under ~/.local/share/hasura (or the configured install path), a regular file occupies an intermediate path component, or the disk/filesystem is read-only or full.

Common situations: Running the CLI as a different user than the one owning the plugins dir; HOME/XDG vars pointing somewhere unwritable; Docker/container read-only volume; leftover file named like the target directory after a partial install.

Related errors


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