{"record":{"id":"91f0dc430881fcca","repo":"lima-vm/lima","slug":"rsync-not-found-on-host-w","errorCode":null,"errorMessage":"rsync not found on host: %w","messagePattern":"rsync not found on host: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/copytool/rsync.go","lineNumber":27,"sourceCode":"\t\"os/exec\"\n\t\"strings\"\n\n\t\"al.essio.dev/pkg/shellescape\"\n\t\"github.com/sirupsen/logrus\"\n\n\t\"github.com/lima-vm/lima/v2/pkg/limatype\"\n\t\"github.com/lima-vm/lima/v2/pkg/sshutil\"\n)\n\ntype rsyncTool struct {\n\ttoolPath string\n\tOptions  *Options\n}\n\nfunc newRsyncTool(opts *Options) (*rsyncTool, error) {\n\ttoolPath, err := exec.LookPath(\"rsync\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"rsync not found on host: %w\", err)\n\t}\n\treturn &rsyncTool{toolPath: toolPath, Options: opts}, nil\n}\n\nfunc (t *rsyncTool) Name() string {\n\treturn t.toolPath\n}\n\nfunc (t *rsyncTool) IsAvailableOnGuest(ctx context.Context, paths []string) bool {\n\tcopyPaths, err := parseCopyPaths(ctx, paths)\n\tif err != nil {\n\t\tlogrus.Debugf(\"failed to parse copy paths for rsync availability check: %v\", err)\n\t\treturn false\n\t}\n\tinstances := make(map[string]*limatype.Instance)\n\n\tfor _, cp := range copyPaths {\n\t\tif cp.IsRemote {","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/copytool/rsync.go#L9-L45","documentation":"newRsyncTool wraps the result of exec.LookPath(\"rsync\"): if the rsync binary cannot be located on the host's PATH, construction fails with this error. It is thrown eagerly when a caller (e.g. copytool.New) requests the rsync backend so the failure surfaces before any copy operation begins.","triggerScenarios":"Calling copytool.New (or NewRsyncTool path) when `rsync` is not installed on the host, is not on PATH, or PATH is stripped in the executing environment (systemd services, GUI apps, containers).","commonSituations":"Minimal CI containers or slim Linux distros without rsync installed; running limactl via cron/systemd where PATH lacks /usr/bin set up incorrectly; macOS users who removed rsync (removed from macOS 15 base expectations) or use Homebrew rsync not on PATH.","solutions":["Install rsync on the host (apt/dnf/brew install rsync) and verify with `command -v rsync`.","Ensure the directory containing rsync is in PATH for the process running limactl (export PATH=...).","Use an alternative copy backend (e.g. scp) if rsync is not needed."],"exampleFix":"// before: fails with 'rsync not found on host'\ncpTool, err := copytool.New(ctx, inst, nil)\n// after: ensure rsync exists before invoking, or fall back\nif _, err := exec.LookPath(\"rsync\"); err != nil {\n    os.Setenv(\"PATH\", \"/usr/bin:/usr/local/bin:\"+os.Getenv(\"PATH\"))\n}\ncpTool, err := copytool.New(ctx, inst, nil)","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"rsync\"); err != nil {\n    return fmt.Errorf(\"prerequisite missing: install rsync on host: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"cpTool, err := copytool.New(ctx, inst, nil)\nif err != nil && strings.Contains(err.Error(), \"rsync not found on host\") {\n    // fall back to another backend or surface an install hint\n}\nreturn err","preventionTips":["Provision host images/CI containers with rsync preinstalled.","Check LookPath for required binaries at tool startup, before any VM operation.","Avoid stripping PATH in service environments that launch limactl."],"tags":["rsync","host-environment","path-lookup","dependency-missing"],"backgroundTag":"command-not-found","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}