lima-vm/lima · error
failed to get rsync version: %w
Error message
failed to get rsync version: %w
What it means
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.
Source
Thrown at cmd/limactl/shell.go:437
sshExecForRsync *exec.Cmd
rsync copytool.CopyTool
)
if syncHostWorkdir {
logrus.Infof("Syncing host current directory(%s) to guest instance...", hostCurrentDir)
sshExecForRsync = exec.CommandContext(ctx, sshExe.Exe, sshArgs...)
// Create the destination directory in the guest instance,
// we could have done this by using `--rsync-path` but it's more
// complex to quote properly.
if err := executeSSHForRsync(ctx, *sshExecForRsync, inst.SSHLocalPort, inst.SSHAddress, fmt.Sprintf("mkdir -p %s", shellescape.Quote(destRsyncDir))); err != nil {
return fmt.Errorf("failed to create the synced workdir in guest instance: %w", err)
}
// Quote the destination path for rsync versions before 3.2.4, where --protect-args is not the default
// and the remote shell would split paths containing spaces.
rsyncVer, err := rsyncVersion(ctx)
if err != nil {
return fmt.Errorf("failed to get rsync version: %w", err)
}
if rsyncVer.LessThan(*semver.New("3.2.4")) {
destRsyncDir = shellescape.Quote(destRsyncDir)
}
paths := []string{
hostCurrentDir,
fmt.Sprintf("%s:%s", inst.Name, destRsyncDir),
}
rsync, err = copytool.New(ctx, string(copytool.BackendRsync), paths, ©tool.Options{
Recursive: true,
Verbose: false,
AdditionalArgs: []string{
"--delete",
},
})
if err != nil {
return errView on GitHub (pinned to dd909d0973)
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).
Example fix
# before (broken shim in PATH) limactl shell default --sync . # after rm ~/bin/rsync # remove shim; keep only the real rsync rsync --version # sanity-check limactl shell default --sync .
Defensive patterns
Strategy: validation
Validate before calling
rsync --version >/dev/null 2>&1 || { echo 'rsync --version is broken; reinstall rsync'; exit 1; } Type guard
null
Try / catch
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
Prevention
- 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.
When it happens
Trigger: `--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.
Common situations: 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.
Related errors
- rsync is required for `--sync` but not found: %w
- expected the depth of the host working directory (%#q) to be
- failed to create the synced workdir in guest instance: %w
- cannot use `--sync` when the instance has host mounts config
- cannot use `--sync` with a wsl2 instance, the host directory
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/7eb16e375d6829e6.
Report an issue: GitHub.