lima-vm/lima · warning
failed to write rsync stats to pager: %w
Error message
failed to write rsync stats to pager: %w
What it means
limactl writes the rsync dry-run statistics and headers into the pager's stdin pipe before streaming the diff. If that write fails — typically because the pager exited early and closed the read end, producing EPIPE — this error is returned. The guest synced workdir remains preserved.
Source
Thrown at cmd/limactl/shell.go:678
// Write rsync dry-run output first
if stats != nil {
rsyncHead := fmt.Sprintf("%s--- rsync dry-run statistics ---%s", colorGray, colorNone)
diffHead := fmt.Sprintf("%s--- detailed diff --- %s", colorGray, colorNone)
if diffCmd == nil {
diffHead = fmt.Sprintf("%s--- detailed diff unavailable (`diff` not found) --- %s", colorGray, colorNone)
}
combinedOutput := fmt.Sprintf(
"%s\n%s\n\n%s\n\n\n%s\n",
rsyncHead,
stats.String(),
rawOutput,
diffHead,
)
if _, err := fmt.Fprint(pipeIn, combinedOutput); err != nil {
_ = pipeIn.Close()
return fmt.Errorf("failed to write rsync stats to pager: %w", err)
}
}
if diffCmd != nil {
if err := diffCmd.Run(); err != nil {
// Command `diff` returns exit code 1 when files differ.
var exitErr *exec.ExitError
if errors.As(err, &exitErr) && exitErr.ExitCode() >= 2 {
_ = pipeIn.Close()
return fmt.Errorf("failed to run diff command: %w", err)
}
}
}
_ = pipeIn.Close()
if err := lessCmd.Wait(); err != nil {
return fmt.Errorf("failed to wait for less command: %w", err)View on GitHub (pinned to dd909d0973)
Solutions
- Retry the preview and keep the pager open until output finishes (don't press q while it's writing).
- Unset or fix PAGER (use `less -R`) if your pager wrapper exits early.
- Choose Yes/No at the prompt instead of the preview to complete the flow.
- Verify large rsync stats output isn't triggering a pager buffer/crash; test with `PAGER=less limactl shell`.
Example fix
// before export PAGER="custom-pager --quick" # exits early, breaks the pipe // after export PAGER="less -R"
Defensive patterns
Strategy: fallback
Validate before calling
case "${PAGER:-less}" in *less*) echo 'standard pager, pipe-safe' ;; *) echo "custom PAGER '${PAGER}' may exit early and break the pipe" ;; esac Try / catch
// if the preview write fails, just answer the prompt without preview limactl shell default || true # rerun and choose Yes/No directly
Prevention
- Use less (with -R) as the pager for lima previews.
- Don't quit the pager while output is still streaming.
- Avoid pager wrappers that exit immediately on piped input.
- Treat preview as optional: Yes/No works without it.
When it happens
Trigger: Viewing changed contents when the pager terminates before/while the stats text is written: user quits `less` immediately (q), the pager crashes on the input, or the pipe is broken between StdinPipe creation and the Fprint.
Common situations: User pressing 'q' very quickly in less; PAGER set to a program that exits immediately (e.g. `cat` variants that fail, or a pager incompatible with the piped input); SIGPIPE handling differences in odd pager wrappers.
Related errors
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/37d6f95bb08a011a.
Report an issue: GitHub.