Why scheduled AzCopy, AWS CLI and rclone jobs fail silently
A scheduled download job is easy to set up and easy to forget. Most failures are not loud: the task shows as having run, the log has an error nobody reads, and the folder simply stops getting new files. This guide lists the places where AzCopy, the AWS CLI and rclone can fail without telling you, with the documentation behind each, and a short check that catches them.
1. The task "ran", but the command failed
A scheduler can tell you that a command started. Whether the download worked is in the command's exit code. AzCopy documents exit code 0 for a job that finished successfully, 1 for an error (read the log), and 2 for a panic. The AWS CLI documents 1 when one or more Amazon S3 transfers failed. If your script ignores the exit code, a failed run looks like a good one.
2. The error is in a log nobody reads
AzCopy writes a log and a plan file for every job, by default under %USERPROFILE%\.azcopy on Windows. It retries network errors, timeouts and server-busy errors up to 20 times, so the first error in a log can be harmless, and Microsoft says to look for the lines marked DOWNLOADFAILED, UPLOADFAILED or COPYFAILED instead. Send the log or its summary to a place where someone looks, and alert on a bad exit code.
3. Nothing was transferred, and that counts as success
rclone exits with code 0 if there were no errors. Its documentation describes the option --error-on-no-transfer, which makes rclone return exit code 9 when no files were transferred, so scripts can tell "copied something" from "copied nothing". Without it, three days without a new file looks exactly like three days of success. A bucket that really should receive a file every day needs its own "nothing arrived" alert.
4. Archived files are skipped with a warning
Amazon S3 objects in the S3 Glacier Flexible Retrieval or Deep Archive storage classes are not immediately accessible and must be restored first. The AWS CLI prints a warning for them and, according to its reference, the warning makes the return code 2. The --ignore-glacier-warnings option turns the warnings off, and the same documentation says they then no longer cause the return code to be 2. Use that option only when you know that skipping those files is what you want.
5. The credential or token expired
An Azure SAS token has start and expiry times and a fixed set of permissions. Microsoft lists the expiration and start times, missing permissions, and the storage account firewall as common causes of 403 errors that fail a transfer. A token that was fine for a year stops the job on the day it expires. Put the expiry date in a calendar, or use a stored access policy that you can extend.
6. "Same file" is decided by a rule you did not choose
AzCopy sync compares file names and last-modified times by default, and offers --compare-hash to compare hashes. aws s3 sync has its own rule, with the --size-only and --exact-timestamps options to change it. A replacement that the rule cannot tell apart from the old file (the same name, size and timestamp, for example) is skipped as already downloaded. Both tools can also delete local files that are not in the source (--delete-destination and --delete), so check those flags before you add them.
A short check that catches most of it
- Read the exit code in your script and alert on anything that is not 0.
- Alert when no new file has arrived in the time you expect one.
- Keep logs for each run and send a summary to a person or a channel.
- Calendar the expiry of every token and key.
- Test the failure path once: revoke the token on a test container and see who hears about it.
- Write down which file-matching rule your tool uses, and whether any delete flag is on.
Where BucketWatch fits
BucketWatch is coming soon and is built around these failure points: it shows a failed or partial download as a failure, remembers which files it has, alerts you when something fails or when it has not been able to check the storage for a while, and on the Pro plan reads the exit code of the program it runs after each file. We have not set a launch date, and the checklist above works with the tools you have today.
Sources
- Microsoft Learn: Troubleshoot issues in AzCopy v10
- Microsoft Learn: Find errors and resume jobs by using log and plan files in AzCopy
- Microsoft Learn: Synchronize with Azure Blob storage by using AzCopy
- Microsoft Learn: Transfer data with AzCopy and file storage (sync comparison and --delete-destination)
- AWS CLI User Guide: Return codes
- AWS CLI Command Reference: aws s3 sync
- Amazon S3 User Guide: Restoring archived objects
- rclone documentation: Exit code and --error-on-no-transfer
Coming soon: BucketWatch
New cloud files, downloaded to your folder. BucketWatch is a Windows service that watches an Azure Blob container or an Amazon S3 bucket and downloads new files to a folder you choose, local or on a network share. The Pro plan can then start your import program on each file. It alerts you when anything fails. It is for companies whose partner, lab or bank drops files into cloud storage but whose software only reads a folder.
Get BucketWatch first
Join the list and get 25% off your first purchase when it goes on sale. We email you a discount code on launch day. One code per person, for new customers.
One email when it launches (plus the discount code). No other mail, and you can say stop at any time. See our privacy policy.