{"record":{"id":"7eb16e375d6829e6","repo":"lima-vm/lima","slug":"failed-to-get-rsync-version-w","errorCode":null,"errorMessage":"failed to get rsync version: %w","messagePattern":"failed to get rsync version: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/shell.go","lineNumber":437,"sourceCode":"\t\tsshExecForRsync *exec.Cmd\n\t\trsync           copytool.CopyTool\n\t)\n\tif syncHostWorkdir {\n\t\tlogrus.Infof(\"Syncing host current directory(%s) to guest instance...\", hostCurrentDir)\n\t\tsshExecForRsync = exec.CommandContext(ctx, sshExe.Exe, sshArgs...)\n\n\t\t// Create the destination directory in the guest instance,\n\t\t// we could have done this by using `--rsync-path` but it's more\n\t\t// complex to quote properly.\n\t\tif err := executeSSHForRsync(ctx, *sshExecForRsync, inst.SSHLocalPort, inst.SSHAddress, fmt.Sprintf(\"mkdir -p %s\", shellescape.Quote(destRsyncDir))); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create the synced workdir in guest instance: %w\", err)\n\t\t}\n\n\t\t// Quote the destination path for rsync versions before 3.2.4, where --protect-args is not the default\n\t\t// and the remote shell would split paths containing spaces.\n\t\trsyncVer, err := rsyncVersion(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get rsync version: %w\", err)\n\t\t}\n\t\tif rsyncVer.LessThan(*semver.New(\"3.2.4\")) {\n\t\t\tdestRsyncDir = shellescape.Quote(destRsyncDir)\n\t\t}\n\n\t\tpaths := []string{\n\t\t\thostCurrentDir,\n\t\t\tfmt.Sprintf(\"%s:%s\", inst.Name, destRsyncDir),\n\t\t}\n\t\trsync, err = copytool.New(ctx, string(copytool.BackendRsync), paths, &copytool.Options{\n\t\t\tRecursive: true,\n\t\t\tVerbose:   false,\n\t\t\tAdditionalArgs: []string{\n\t\t\t\t\"--delete\",\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/shell.go#L419-L455","documentation":"To decide whether rsync destination paths need manual quoting, Lima runs `rsync --version` on the host and parses the semver: versions before 3.2.4 do not default to `--protect-args`, so paths with spaces would be split by the remote shell. If `rsyncVersion` cannot execute or parse rsync's version output, the command aborts wrapped in this message.","triggerScenarios":"`--sync` is active, the mkdir step succeeded, and then `rsyncVersion(ctx)` fails — e.g. the rsync binary exists in PATH but is broken/incompatible, exits non-zero for `--version`, or prints output the semver parser cannot understand.","commonSituations":"A shim/wrapper script named rsync that swallows `--version`; MSYS2/Cygwin rsync conflicts on Windows; an ancient or patched rsync build with non-standard version output; partially upgraded systems where rsync is corrupted.","solutions":["Run `rsync --version` manually and fix whatever makes it fail or print garbage (reinstall rsync if corrupted).","Remove conflicting rsync shims from PATH so the real binary is found (`which -a rsync`).","Install a standard, current rsync build (>= 3.2.4 also avoids the legacy quoting path)."],"exampleFix":"# before (broken shim in PATH)\nlimactl shell default --sync .\n# after\nrm ~/bin/rsync   # remove shim; keep only the real rsync\nrsync --version  # sanity-check\nlimactl shell default --sync .","handlingStrategy":"validation","validationCode":"rsync --version >/dev/null 2>&1 || { echo 'rsync --version is broken; reinstall rsync'; exit 1; }","typeGuard":"null","tryCatchPattern":"if ! limactl shell \"$inst\" --sync . 2>&1 | grep -q 'rsync version'; then :; else PATH=$(echo \"$PATH\" | tr ':' '\\n' | grep -v shims | paste -sd:) limactl shell \"$inst\" --sync .; fi","preventionTips":["Verify `rsync --version` works after installing or upgrading rsync.","Remove rsync shims/wrappers from PATH that break `--version` output.","Use a standard distro/official rsync build rather than custom patched binaries.","Prefer rsync >= 3.2.4 to also skip the legacy quoting path."],"tags":["cli","limactl","rsync","version-check","sync"],"backgroundTag":"binary-version-probe-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}