{"record":{"id":"22639fb7084ce2a2","repo":"hasura/graphql-engine","slug":"failed-to-stat-the-currently-executed-path-q","errorCode":null,"errorMessage":"failed to stat the currently executed path (%q): %w","messagePattern":"failed to stat the currently executed path \\(%q\\): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/plugins/paths/paths.go","lineNumber":104,"sourceCode":"\n// PluginVersionInstallPath returns the path to the specified version of specified\n// plugin.\n//\n// e.g. {PluginInstallPath}/{plugin}/{version}.\nfunc (p Paths) PluginVersionInstallPath(plugin, version string) string {\n\treturn filepath.Join(p.InstallPath(), plugin, version)\n}\n\n// Realpath evaluates symbolic links. If the path is not a symbolic link, it\n// returns the cleaned path. Symbolic links with relative paths return error.\nfunc Realpath(path string) (string, error) {\n\tvar op errors.Op = \"paths.Realpath\"\n\n\ts, err := os.Lstat(path)\n\tif err != nil {\n\t\treturn \"\", errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\"failed to stat the currently executed path (%q): %w\", path, err),\n\t\t)\n\t}\n\n\tif s.Mode()&os.ModeSymlink != 0 {\n\t\tif path, err = os.Readlink(path); err != nil {\n\t\t\treturn \"\", errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\n\t\t\t\t\t\"failed to resolve the symlink of the currently executed version: %w\",\n\t\t\t\t\terr,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\tif !filepath.IsAbs(path) {\n\t\t\treturn \"\", errors.E(op, fmt.Errorf(\"symbolic link is relative (%s): %w\", path, err))\n\t\t}\n\t}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/plugins/paths/paths.go#L86-L122","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the path in the error exists: ls -la on it and its parents","If the versioned binary was removed by an upgrade/cleanup, reinstall the CLI/plugin version or re-point the launcher symlink","Fix search (x) permissions on parent directories if that's the blocker","Avoid deleting version dirs of a binary that may still be executing (defer cleanup)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := os.Lstat(exePath); err != nil {\n    return fmt.Errorf(\"binary path missing before launch: %w\", err)\n}","typeGuard":"func pathExists(p string) bool { _, err := os.Lstat(p); return err == nil }","tryCatchPattern":"if real, err := plugins.Realpath(p); err != nil {\n    if errors.Is(err, fs.ErrNotExist) { /* reinstall version or fix launcher symlink */ }\n}","preventionTips":["Don't delete versioned binary dirs while binaries may be executing","Verify launcher symlinks after CLI upgrades","Defer cleanup of old versions to a grace period"],"tags":["go","filesystem","symlink","stat"],"backgroundTag":"executable-path-stat-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}