Skip to content

/codes/rsync/rsync-exit-codes

rsync exit codes: 1, 2, 3, 5, 10, 11, 12, 23, 24, 30, 35 and 255 explained

The commands on this page have not been executed by our verification runner yet.updated
tool
rsync
versions
rsync 3.x
os
linux, macos

rsync exits with 0 on success and with a specific code for each kind of failure. The codes that appear most are 23 (some files or attributes were not transferred), 24 (source files vanished during the transfer), 12 (protocol data stream error, usually the remote side failed to start), and 255 (unexplained error), usually the exit status of a failed SSH connection passed through. When rsync fails it prints rsync error: MESSAGE (code N); the table lists the code, the man page meaning and the message from rsync's source.

CodeMeaning (man page)Message printed by rsync
0Success(none)
1Syntax or usage errorsyntax or usage error
2Protocol incompatibilityprotocol incompatibility
3Errors selecting input/output files, directorieserrors selecting input/output files, dirs
4Requested action not supportedrequested action not supported
5Error starting client-server protocolerror starting client-server protocol
10Error in socket I/Oerror in socket IO
11Error in file I/Oerror in file IO
12Error in rsync protocol data streamerror in rsync protocol data stream
13Errors with program diagnosticserrors with program diagnostics
14Error in IPC codeerror in IPC code
15Sibling process crashedsibling process crashed
16Sibling process was killed by a signalsibling process terminated abnormally
19Received SIGUSR1received SIGUSR1
20Received SIGINT, SIGTERM, or SIGHUPreceived SIGINT, SIGTERM, or SIGHUP
21Some error returned by waitpid()waitpid() failed
22Error allocating core memory bufferserror allocating core memory buffers
23Partial transfer due to errorsome files/attrs were not transferred (see previous errors)
24Partial transfer due to vanished source filessome files vanished before they could be transferred (a warning)
25The --max-delete limit stopped deletionsthe --max-delete limit stopped deletions
30Timeout in data send/receivetimeout in data send/receive
35Timeout waiting for daemon connectiontimeout waiting for daemon connection

Codes from the remote shell

rsync's source also names codes for failures of the remote shell command it starts (SSH by default). They are not in the man page list; unexplained error is what rsync prints for any code it has no name for:

CodeMessageTypical cause
124remote shell failedThe remote shell command exited with status 255
125remote shell killedThe remote shell was killed by a signal
126remote command could not be runThe remote shell or --rsync-path is not executable
127remote command not foundA command was not found: the remote shell program, or rsync on the remote host
255unexplained errorUsually passed through from ssh, which exits 255 when it cannot connect or authenticate

Handle codes in a backup script

bash
rsync -a --delete /srv/data/ backup:/backups/data/
case $? in
  0)  echo "ok" ;;
  24) echo "ok, some files vanished during the copy" ;;
  23) echo "partial: check the rsync: lines above" >&2; exit 23 ;;
  *)  echo "rsync failed" >&2; exit 1 ;;
esac

Treat 24 as success for live directories (logs, caches, mail spools) where files are deleted while rsync runs. Do not ignore 23 by default: it hides permission problems that leave files out of the backup.

Sources