hasura/graphql-engine · error

failed to stat the currently executed path (%q): %w

Error message

failed to stat the currently executed path (%q): %w

What it means

paths.Realpath lstats the given path (typically the currently executed CLI binary or versioned binary path) to detect symlinks, and os.Lstat failed. The path does not exist (ENOENT), a parent is not searchable (EACCES), or an I/O error occurred — so the executable's real location could not be determined.

Source

Thrown at cli/plugins/paths/paths.go:104

// PluginVersionInstallPath returns the path to the specified version of specified
// plugin.
//
// e.g. {PluginInstallPath}/{plugin}/{version}.
func (p Paths) PluginVersionInstallPath(plugin, version string) string {
	return filepath.Join(p.InstallPath(), plugin, version)
}

// Realpath evaluates symbolic links. If the path is not a symbolic link, it
// returns the cleaned path. Symbolic links with relative paths return error.
func Realpath(path string) (string, error) {
	var op errors.Op = "paths.Realpath"

	s, err := os.Lstat(path)
	if err != nil {
		return "", errors.E(
			op,
			fmt.Errorf("failed to stat the currently executed path (%q): %w", path, err),
		)
	}

	if s.Mode()&os.ModeSymlink != 0 {
		if path, err = os.Readlink(path); err != nil {
			return "", errors.E(
				op,
				fmt.Errorf(
					"failed to resolve the symlink of the currently executed version: %w",
					err,
				),
			)
		}

		if !filepath.IsAbs(path) {
			return "", errors.E(op, fmt.Errorf("symbolic link is relative (%s): %w", path, err))
		}
	}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify the path in the error exists: ls -la on it and its parents
  2. If the versioned binary was removed by an upgrade/cleanup, reinstall the CLI/plugin version or re-point the launcher symlink
  3. Fix search (x) permissions on parent directories if that's the blocker
  4. Avoid deleting version dirs of a binary that may still be executing (defer cleanup)
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Lstat(exePath); err != nil {
    return fmt.Errorf("binary path missing before launch: %w", err)
}

Type guard

func pathExists(p string) bool { _, err := os.Lstat(p); return err == nil }

Try / catch

if real, err := plugins.Realpath(p); err != nil {
    if errors.Is(err, fs.ErrNotExist) { /* reinstall version or fix launcher symlink */ }
}

Prevention

When it happens

Trigger: Calling Realpath on a path that has been deleted or moved (e.g. a versioned binary dir removed during upgrade/cleanup), or whose parent directories deny search permission to the current user.

Common situations: Concurrent plugin/CLI upgrade removing the versioned binary while it runs; hasura binary invoked via a symlink whose target was uninstalled; permissions changed on the install prefix; stale wrapper script pointing at a removed path.

Related errors


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