Exit Code 0 on ACD 'directory not found' error (All retries fail)

HI,

Having read the docs at: https://rclone.org/docs/#exit-code

I am checking for a non-zero exit code to an Amazon ACD remote in rcode thus:

rclone -q copy "${FILE}" remote:"$DIRSTRUCT/" 2> >(/usr/bin/tee -a ~/rclone.log >&2)
if [ $? -ne 0 ]; then
      cat ~/rclone.log | mail -s "rclone failure" me@address
fi

I have verified the ‘tee’ in the pipe is not corrupting the exit code using ‘/bin/true’ and ‘/bin/false’, and I see the following logs in rclone.log that did not alert me. And checking mail logs there was no attempt to mail out.

2017/05/16 00:05:03 ERROR : Attempt 1/3 failed with 1 errors and: directory not found
2017/05/16 00:05:03 ERROR : Attempt 2/3 failed with 1 errors and: directory not found
2017/05/16 00:05:03 ERROR : Attempt 3/3 failed with 1 errors and: directory not found
2017/05/16 00:05:03 Failed to purge: directory not found
2017/05/17 00:05:10 ERROR : Attempt 1/3 failed with 1 errors and: directory not found
2017/05/17 00:05:10 ERROR : Attempt 2/3 failed with 1 errors and: directory not found
2017/05/17 00:05:10 ERROR : Attempt 3/3 failed with 1 errors and: directory not found
2017/05/17 00:05:10 Failed to purge: directory not found

I suspect there may be an unchecked error here that is missing the ‘retry’ trigger (after retries) and returning a 0.

It’s hard to recreate the error as I can’t get rclone to purposely fail, it’s intermittent, and rclone works flawlessly 99.9% of the time…

Am I missing some flag that I can’t see in the docs?

Following lots of Googling on this, I did see a similar problem highlighted here:

But it was never followed up with logs…

What is interesting in my logs, it that the 3 retries all occur within the same second:

2017/05/16 00:05:03 ERROR : Attempt 1/3 failed with 1 errors and: directory not found
2017/05/16 00:05:03 ERROR : Attempt 2/3 failed with 1 errors and: directory not found
2017/05/16 00:05:03 ERROR : Attempt 3/3 failed with 1 errors and: directory not found
2017/05/16 00:05:03 Failed to purge: directory not found