The Codes You Will Actually See
| Code | Meaning | Usual cause |
|---|---|---|
| 23 | Partial transfer due to error | Permission denied, a source path that does not exist, attributes the destination cannot store |
| 24 | Some source files vanished | Files deleted or rotated while rsync ran |
| 255 | SSH failed ("unexplained error") | Wrong host or port, refused or timed-out connection, key not accepted |
| 2 | Protocol incompatibility | The remote shell prints a banner or text on login |
| 127 | Remote command not found | rsync not installed on the remote, or a wrong --rsync-path |
| 12 | Error in the protocol data stream | Connection dropped mid-transfer, remote disk full, remote rsync killed |
| 11 | Error in file I/O | Disk full or read-only at the destination |
| 30 | Timeout in data send or receive | --timeout reached on a stalled connection |
| 1 | Syntax or usage error | A mistyped option |
Error 23: Some Files Were Not Transferred
rsync: [sender] link_stat "/srv/data/missing" failed: No such file or directory (2) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1356) [sender=3.2.7]
The run completed, but the lines above the error list what was skipped. Typical fixes: correct a path that does not exist; run as a user that can read every source file (or with sudo); and when the destination cannot store owners or permissions (some network shares and storage services cannot), drop them with --no-owner --no-group or --no-perms instead of -a's defaults.
Error 24: Files Vanished
rsync builds its file list first and copies second. Files deleted in between, such as rotated logs, cache files and temporary uploads, produce file has vanished warnings and exit code 24. It is harmless. Exclude busy directories with --exclude, or treat 24 as success in your script.
Error 255: SSH Failed
rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(232) [sender=3.2.7]
rsync could not get an SSH connection. Test SSH on its own with the same options; the real error appears there. A non-standard port is the classic cause: pass it with -e "ssh -p 23". Fixing SSH errors covers refused, timed-out and key problems.
ssh -p 23 USER@HOST # does plain SSH work? rsync -av -e "ssh -p 23" ./data/ USER@HOST:data/
Error 2: Protocol Version Mismatch
protocol version mismatch -- is your shell clean? (see the rsync manpage for an explanation) rsync error: protocol incompatibility (code 2) at compat.c(622) [sender=3.2.7]
rsync talks to the remote rsync over the SSH session, so anything the remote prints on login (a welcome message or an echo in .bashrc) corrupts the stream. Test with ssh USER@HOST true | wc -c: the answer must be 0. Move the output into a check that only runs for interactive shells, such as [[ $- == *i* ]] && echo hello.
Error 127: rsync Not Found on the Remote
rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: remote command not found (code 127) at io.c(232) [sender=3.2.7]
The other end has no rsync, or not where expected. Install it there (apt install rsync), or point at it with --rsync-path=/path/to/rsync. If you cannot install anything on the remote, copy with SFTP-based tools instead: see rsync vs scp vs rclone.
Error 12 and Error 11: Stream and Disk Problems
Code 12 means the data stream between the two rsyncs broke mid-transfer: the connection dropped, the remote rsync was killed, or the remote disk filled up. Code 11 is a read or write failure on a file, most often a full or read-only destination. Check free space on the destination with df -h first, then retry with --partial so large files resume instead of starting over.