rsync Error: 'some files/attrs were not transferred (code 23)' — Cause, Fix, and Troubleshooting Guide
Fix rsync error: some files/attrs were not transferred (see previous errors) (code 23) — permission denied, vanished files, and attr-preserve failures.
- #automation
- #troubleshooting
- #rsync
Fixing errors like this? Get 500 free DevOps AI prompts
500 copy-paste AI prompts for the stack you actually run — one PDF, free.
Overview
Exit code 23 means rsync finished, but some files or attributes did not make it across. This is a partial success, not a total failure: most of the transfer worked, and rsync is telling you a subset of files were skipped or their metadata could not be applied. The real diagnosis is always in the lines above the summary — the “(see previous errors)” is not boilerplate, it is the instruction.
$ rsync -a /opt/jobs/src/ myuser@example.com:/opt/jobs/dst/
rsync: [sender] send_files failed to open "/opt/jobs/src/secret.key": Permission denied (13)
rsync: [generator] failed to set times on "/opt/jobs/dst/logs": Operation not permitted (1)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
Code 23 is easy to misread as a fatal error and retry blindly. Because it is partial, blind retries transfer the same good files again while the same few problem files keep failing. Fix the specific errors listed above the summary instead.
Symptoms
- rsync exits with status
23and the messagesome files/attrs were not transferred (see previous errors). - One or more
Permission denied (13),Operation not permitted (1), orfile has vanishedlines appear earlier in the output. - Most files copy successfully; only a handful are missing at the destination.
- The job “succeeds” by copying data but a CI/backup step marks it failed because of the non-zero exit.
- Re-running transfers fewer bytes but still exits 23 on the same files.
echo "rsync exit: $?"
rsync exit: 23
Common Root Causes
1. Permission denied on specific source files
rsync cannot read a file it was told to send — common with keys, root-owned files, or .ssh contents when running as an unprivileged user.
rsync: [sender] send_files failed to open "/opt/jobs/src/secret.key": Permission denied (13)
2. Cannot preserve attributes on the destination filesystem
-a implies --perms --owner --group --times. On a destination that cannot represent them (a FAT/exFAT mount, an SMB share, or a non-root user trying to chown), setting the attribute fails even though the data copies.
rsync: [generator] failed to set times on "/opt/jobs/dst/logs": Operation not permitted (1)
rsync: chown "/opt/jobs/dst/app" failed: Operation not permitted (1)
3. Files vanished mid-transfer
rsync built its file list, then a file was deleted or rotated before it was sent — common when syncing an active log or spool directory.
file has vanished: "/opt/jobs/src/queue/tmp-8842"
4. Unreadable directories or broken symlinks
A directory without execute/read permission, or a symlink pointing nowhere, produces per-entry errors that roll up into code 23.
5. Path or name length limits on the destination
A path longer than the destination filesystem allows, or a filename with characters the target FS rejects, fails for those entries only.
6. Extended attributes / ACLs not supported
-X (xattrs) or -A (ACLs) against a filesystem or transport that does not support them fails to set metadata while still copying content.
How to Diagnose
Step 1: Read the errors above the summary
rsync -a /opt/jobs/src/ myuser@example.com:/opt/jobs/dst/ 2>&1 | grep -Ei 'denied|not permitted|vanished|failed'
rsync: [sender] send_files failed to open "/opt/jobs/src/secret.key": Permission denied (13)
The specific paths named here are the entire problem set.
Step 2: Add verbosity and itemized changes
rsync -avi --stats /opt/jobs/src/ myuser@example.com:/opt/jobs/dst/ 2>&1 | tail -20
-i (itemize) plus --stats shows exactly which files were skipped and confirms how many failed versus transferred.
Step 3: Check permissions on a named source file
ls -l /opt/jobs/src/secret.key
id
-rw------- 1 root root 3243 Jul 10 09:14 /opt/jobs/src/secret.key
uid=1000(myuser) gid=1000(myuser)
Root-owned 0600 file, running as myuser — unreadable, so it is skipped.
Step 4: Determine whether it is data or attributes failing
# Copy content only, no metadata preservation
rsync -rv --no-perms --no-owner --no-group /opt/jobs/src/ myuser@example.com:/opt/jobs/dst/
echo "exit: $?"
exit: 0
If dropping attribute preservation makes it exit 0, the failure was metadata, not the files themselves.
Step 5: Rule out a full destination (that is code 11, not 23)
ssh myuser@example.com df -h /opt/jobs/dst
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 100G 41G 59G 41% /opt/jobs
A full disk usually surfaces as No space left on device (28) and exit 11; plenty of space here rules it out.
Fixes
For attribute-preserve failures on a limited destination, drop the attributes that cannot be set:
rsync -rlt --no-perms --no-owner --no-group /opt/jobs/src/ myuser@example.com:/opt/jobs/dst/
For permission-denied on source files, run rsync as a user that can read them (or use sudo with a wrapper), or exclude what should not be copied:
rsync -a --exclude 'secret.key' --exclude '*.pem' /opt/jobs/src/ myuser@example.com:/opt/jobs/dst/
For actively changing directories, ignore vanished files so a rotated log does not fail the run:
# Exit 24 (vanished) is treated as success; 23 still fails
rsync -a /opt/jobs/src/ myuser@example.com:/opt/jobs/dst/
rc=$?
[ "$rc" -eq 24 ] && rc=0
exit "$rc"
When preserving ownership is genuinely required, run the receiving side with privilege:
rsync -a --rsync-path='sudo rsync' /opt/jobs/src/ myuser@example.com:/opt/jobs/dst/
What to Watch Out For
- “(see previous errors)” is literal — the summary line alone never tells you what failed.
- Do not confuse code 23 (some attrs/files skipped) with code 11 (
No space left on device) or code 12 (protocol stream error) — they have different fixes. - Exit 24 (“some files vanished”) is a different, often benign code; scripts that treat any non-zero exit as failure will flag it needlessly.
-asilently turns on owner/group/perms/times preservation; on FAT, exFAT, SMB, or cross-user copies those will fail — use explicit flags like-rltinstead.- Retrying without fixing the named files just recopies the good ones and fails on the same subset every time.
Related Guides
- rsync: connection unexpectedly closed (code 12)
- curl (7) Failed to connect after N ms: Connection refused
- Scheduled job orchestration at scale
Fixed it? Get 500 Automation & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.