{"record":{"id":"4ffc9d0bbdec217e","repo":"hasura/graphql-engine","slug":"failed-to-resolve-the-symlink-of-the-currently-exe","errorCode":null,"errorMessage":"failed to resolve the symlink of the currently executed version: %w","messagePattern":"failed to resolve the symlink of the currently executed version: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/plugins/paths/paths.go","lineNumber":112,"sourceCode":"\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}\n\n\treturn filepath.Clean(path), nil\n}\n","sourceCodeStart":94,"sourceCodeEnd":126,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/plugins/paths/paths.go#L94-L126","documentation":"Realpath detected that the path is a symlink and os.Readlink failed to read its target. The symlink exists but its link table entry could not be read — typically EACCES on the containing directory, EIO, or a filesystem that mishandles the readlink syscall.","triggerScenarios":"os.Readlink(path) erroring after Lstat confirmed ModeSymlink: permission denied reading the link, corrupt/unsupported filesystem, or a race where the link was replaced between Lstat and Readlink.","commonSituations":"CLI installed behind a symlink in a directory the user cannot search; symlink swapped by a package manager mid-execution; exotic mounts (some network/overlay filesystems) returning errors for readlink.","solutions":["Check permissions on the directory containing the symlink (needs r+x for the user)","ls -l the symlink to confirm it is intact and points where expected; recreate it if corrupted","If a package manager was concurrently updating the binary, wait and retry the command","Mount/inspect the filesystem if readlink errors persist (overlayfs/NFS quirks)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if fi, err := os.Lstat(p); err == nil && fi.Mode()&os.ModeSymlink != 0 {\n    if _, err := os.Readlink(p); err != nil {\n        return fmt.Errorf(\"symlink unreadable before launch: %w\", err)\n    }\n}","typeGuard":"func isHealthySymlink(p string) bool {\n    fi, err := os.Lstat(p)\n    if err != nil || fi.Mode()&os.ModeSymlink == 0 { return false }\n    _, err = os.Readlink(p)\n    return err == nil\n}","tryCatchPattern":"if real, err := plugins.Realpath(p); err != nil {\n    if strings.Contains(err.Error(), \"resolve the symlink\") {\n        // recreate the symlink / fix parent dir perms, then retry once\n    }\n}","preventionTips":["Ensure the directory holding the launcher symlink is readable+searchable by the user","Recreate broken symlinks after package-manager updates","Avoid exotic mounts for executable paths when possible"],"tags":["go","filesystem","symlink","permissions"],"backgroundTag":"readlink-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}