Dropbox: 'Token refresh failed' Error Midway through Rclone Copy

What is the problem you are having with rclone?

Today I created a new token for Dropbox. Right after creating the token, I used Rclone to copy files from Dropbox to my home server. It downloaded about 24GB of 28GB just fine, then suddenly started getting the error in the last 30-40 minutes:
"couldn't fetch token - maybe it has expired? - refresh with "rclone config reconnect DanielDropBoxAPI:": oauth2: token expired and refresh token is not set"

I did "reclone config reconnect" and it started working again, but what can I do to not have this issue again? I have over 100 GB to transfer from DropBox to my local home server. Should I not use my own token but use the Rclone's token instead?

Run the command 'rclone version' and share the full output of the command.

rclone v1.53.3-DEV

  • os/arch: linux/amd64
  • go version: go1.18.1

Which cloud storage system are you using? (eg Google Drive)

DropBox via API

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copy DanielDropboxAPI:z-sanfrancisco-LongTermArchive/Archive /media/kepala/data4/A02  --transfers=2 -vv  -log-file=mylogfile2.txt

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[DanielDropbox]
type = dropbox
token = {"access_token":"redacted"}

[DanielDropBoxAPI]
type = dropbox
client_id = redacted
client_secret = redacted
token = {"access_token":"redacted"}

A log from the command that you were trying to run with the -vv flag

This is an excerpt, it was running fine for 2-3 hours then it token error started happening

2024/02/05 14:28:53 DEBUG : Backup-Longterm/My Academics/2004.spring/Research/Water/03.02.19 - EurasiaNet - Lobbying Grows in Moscow for Siberia-Uzbekistan Water Scheme_files/georgia_but1.gif: DropboxHash = f0897ae6dca2a4ae807f91a07dee93151e39c4323df788a08fbba9b6a6c5bc57 OK
2024/02/05 14:28:53 INFO  : Backup-Longterm/My Academics/2004.spring/Research/Water/03.02.19 - EurasiaNet - Lobbying Grows in Moscow for Siberia-Uzbekistan Water Scheme_files/georgia_but1.gif: Copied (new)
2024/02/05 14:28:54 DEBUG : Cletus/Cletus/Documents and Settings/Daniel/Cookies/daniel@visitorville[2].txt: DropboxHash = 48f327f10b1f16bad08a90237908d70787e074058b456d875e0fab6f54d2984d OK
2024/02/05 14:28:54 INFO  : Cletus/Cletus/Documents and Settings/Daniel/Cookies/daniel@visitorville[2].txt: Copied (new)
2024/02/05 14:28:54 DEBUG : DanielDropBoxAPI: Loaded invalid token from config file - ignoring
2024/02/05 14:28:54 DEBUG : DanielDropBoxAPI: Token refresh failed try 1/5: oauth2: token expired and refresh token is not set
2024/02/05 14:28:54 DEBUG : Matilda Refugees/Refugees/Pwnage/QuickPwn.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib: DropboxHash = 993c2930e4d0feed33252afd0041fbff179cad1f229ac76e2dabe9b742a2ceda OK
2024/02/05 14:28:54 INFO  : Matilda Refugees/Refugees/Pwnage/QuickPwn.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib: Copied (new)
2024/02/05 14:28:55 DEBUG : DanielDropBoxAPI: Loaded invalid token from config file - ignoring
2024/02/05 14:28:55 DEBUG : DanielDropBoxAPI: Token refresh failed try 2/5: oauth2: token expired and refresh token is not set
2024/02/05 14:28:56 DEBUG : DanielDropBoxAPI: Loaded invalid token from config file - ignoring
2024/02/05 14:28:56 DEBUG : DanielDropBoxAPI: Token refresh failed try 3/5: oauth2: token expired and refresh token is not set
2024/02/05 14:28:57 DEBUG : DanielDropBoxAPI: Loaded invalid token from config file - ignoring
2024/02/05 14:28:57 DEBUG : DanielDropBoxAPI: Token refresh failed try 4/5: oauth2: token expired and refresh token is not set
2024/02/05 14:28:58 DEBUG : DanielDropBoxAPI: Loaded invalid token from config file - ignoring
2024/02/05 14:28:58 DEBUG : DanielDropBoxAPI: Token refresh failed try 5/5: oauth2: token expired and refresh token is not set
2024/02/05 14:28:59 ERROR : Backup-Longterm/My Academics/2004.spring/Research/culture/02.01.17 - Eurasianet.org - KAZAKHSTAN GRAPPLES WITH CULTURAL REVIVAL DILEMMAS_files/avantgo_ad.gif: Failed to copy: failed to open source object: Post "https://content.dropboxapi.com/2/files/download": couldn't fetch token - maybe it has expired? - refresh with "rclone config reconnect DanielDropBoxAPI:": oauth2: token expired and refresh token is not set
2024/02/05 14:28:59 DEBUG : DanielDropBoxAPI: Loaded invalid token from config file - ignoring
2024/02/05 14:28:59 DEBUG : DanielDropBoxAPI: Token refresh failed try 1/5: oauth2: token expired and refresh token is not set
2024/02/05 14:29:00 DEBUG : DanielDropBoxAPI: Loaded invalid token from config file - ignoring

welcome to the forum,

v1.53.3 is over three years old.

so please update to v1.65.2, re-create the remote and test again
https://rclone.org/install/

When already using the latest rclone (no idea if these flags exist in ancient version you are using) add:

--tpslimit 12 --tpslimit-burst 0

It has nothing to do with token refreshing but will help with preventing throttling errors.

@asdffdsa and @kapitainsky - ouf, sorry for that rookie mistake. It's all nice and updated now (see below), but I'm still getting this error. I've given up for now and using Rclone's token, but I would have preferred to use my own but these constant request for renewing the token is slowing me down.

@kapitainsky, I've added "--tpslimit 12 --tpslimit-burst 0" as you suggested. Thank you.

rclone v1.65.2
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 5.15.0-92-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21.6
- go/linking: static
- go/tags: none

I am using multiple dropbox accounts with my own client_id without slightest issues.

I suspect that you made mistake when creating yours - maybe wrong URL in point 7? See docs

Create it again - paying attention to all details. Mistakes happen.

If you change client_id/secret do not forget to update token:

rclone config reconnect DanielDropBoxAPI:

Or just run this command now with the latest rclone. Maybe in the dark ages many years ago rclone was not setting refresh token for dropbox. Which is what could happen when you created it with your ancient rclone.

Maybe even delete old token from your config file completely - and then reconnect.

FYI

nowadays dropbox token should have this structure:

token = {"access_token":"xxx","token_type":"bearer","refresh_token":"xxx","expiry":"2024-01-31T12:45:22.186307Z"}