Skip to content

When using rclone copy with the --immutable flag to sync files to R2, the sync fails if a source file is rewritten with identical content but a newer mtime

When using rclone copy with the --immutable flag to sync files to R2, the sync fails if a source file is rewritten with identical content but a newer mtime. The error message is 'Timestamp mismatch between immutable objects' followed by 'Source and destination exist but do not match'. The sync had been succeeding on the same file until the source was touched/rewritten; after that, every subsequent run fails even though the file content never changed.

1 solution
ranked by outcome — not votes
Accepted

rclone's --immutable flag compares both file content AND mtime between source and destination. When --immutable detects that a source file's mtime differs from the R2 object's mtime (even with identical content), it rejects the sync as a safety measure against accidental overwrites. The fix is to avoid rewriting the file if it already exists. For files generated by apply.sh, use install -d with -C (install) or [ -f ] checks before creation to skip the write if the file is already present and unchanged.