Random IO Error 401: Invalid Credentials

What is the problem you are having with rclone?

At random times I receive an error that states the below. I did not change my credentials,k so I'm not sure why this is occuring.

2019/07/26 21:05:45 ERROR : IO error: couldn't list directory: googleapi: Error 401: Invalid Credentials, authError
2019/07/26 21:05:47 ERROR : /: Dir.Stat error: couldn't list directory: googleapi: Error 401: Invalid Credentials, authError

What is your rclone version (output from rclone version)

v1.48.0

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Win10 x64

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

Google Drive

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

rclone mount --allow-non-empty --allow-other --size-only --timeout 1h --cache-dir F:\rclone_cache --dir-cache-time 2m --vfs-cache-max-age 4h --vfs-read-chunk-size 100M --vfs-read-chunk-size-limit 5G --drive-chunk-size 128M --buffer-size 256M --vfs-cache-mode minimal gcrypt:Media/ T:

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

2019/07/26 21:23:48 DEBUG : rclone: Version "v1.48.0" starting with parameters ["rclone" "-vv" "mount" "--allow-non-empty" "--allow-other" "--size-only" "--timeout" "1h" "--cache-dir" "F:\rclone_cache" "--dir-cache-time" "2m" "--vfs-cache-max-age" "4h" "--vfs-read-chunk-size" "100M" "--vfs-read-chunk-size-limit" "5G" "--drive-chunk-size" "128M" "--buffer-size" "256M" "--vfs-cache-mode" "minimal" "gcrypt:Media/" "T:"]
2019/07/26 21:23:48 DEBUG : Using config file from "C:\Users\***\.config\rclone\rclone.conf"
2019/07/26 21:23:48 DEBUG : Encrypted drive 'gcrypt:Media/': Mounting on "T:"
2019/07/26 21:23:48 INFO : Google drive root 'sfr9rcp0ntlh3dbfdk75l2do4k': Failed to get StartPageToken: googleapi: Error 401: Invalid Credentials, authError
2019/07/26 21:23:48 DEBUG : vfs cache root is "F:\rclone_cache\vfs\gcrypt\Media"
2019/07/26 21:23:48 DEBUG : Adding path "vfs/forget" to remote control registry
2019/07/26 21:23:48 DEBUG : Adding path "vfs/refresh" to remote control registry
2019/07/26 21:23:48 DEBUG : Adding path "vfs/poll-interval" to remote control registry
2019/07/26 21:23:48 DEBUG : Encrypted drive 'gcrypt:Media/': Mounting with options: ["-o" "fsname=gcrypt:Media/" "-o" "subtype=rclone" "-o" "max_readahead=131072" "-o" "attr_timeout=1" "-o" "atomic_o_trunc" "-o" "uid=-1" "-o" "gid=-1" "--FileSystemName=rclone" "-o" "volname=gcrypt Media" "-o" "nonempty" "-o" "allow_other"]
2019/07/26 21:23:48 DEBUG : Encrypted drive 'gcrypt:Media/': Init:
2019/07/26 21:23:48 DEBUG : Encrypted drive 'gcrypt:Media/': >Init:
2019/07/26 21:23:48 DEBUG : /: Statfs:
2019/07/26 21:23:48 ERROR : Encrypted drive 'gcrypt:Media/': Statfs failed: failed to get Drive storageQuota: googleapi: Error 401: Invalid Credentials, authError
2019/07/26 21:23:48 DEBUG : /: >Statfs: stat={Bsize:4096 Frsize:4096 Blocks:274877906944 Bfree:274877906944 Bavail:274877906944 Files:1000000000 Ffree:1000000000 Favail:0 Fsid:0 Flag:0 Namemax:255}, errc=0
2019/07/26 21:23:48 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/07/26 21:23:48 DEBUG : /: >Getattr: errc=0
2019/07/26 21:23:48 DEBUG : /: Readlink:
2019/07/26 21:23:48 DEBUG : /: >Readlink: linkPath="", errc=-40
The service rclone has been started.
2019/07/26 21:23:48 DEBUG : /: Statfs:
2019/07/26 21:23:48 DEBUG : /: >Statfs: stat={Bsize:4096 Frsize:4096 Blocks:274877906944 Bfree:274877906944 Bavail:274877906944 Files:1000000000 Ffree:1000000000 Favail:0 Fsid:0 Flag:0 Namemax:255}, errc=0
2019/07/26 21:23:48 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/07/26 21:23:48 DEBUG : /: >Getattr: errc=0
2019/07/26 21:23:48 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/07/26 21:23:48 DEBUG : /: >Getattr: errc=0
2019/07/26 21:23:48 DEBUG : /: Opendir:
2019/07/26 21:23:48 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2019/07/26 21:23:48 DEBUG : /: >OpenFile: fd=/ (r), err=
2019/07/26 21:23:48 DEBUG : /: >Opendir: errc=0, fh=0x0
2019/07/26 21:23:48 DEBUG : /: Releasedir: fh=0x0
2019/07/26 21:23:48 DEBUG : /: >Releasedir: errc=0
2019/07/26 21:23:48 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/07/26 21:23:48 DEBUG : /: >Getattr: errc=0
2019/07/26 21:23:48 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/07/26 21:23:48 DEBUG : /: >Getattr: errc=0
2019/07/26 21:23:48 DEBUG : /: Opendir:
2019/07/26 21:23:48 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2019/07/26 21:23:48 DEBUG : /: >OpenFile: fd=/ (r), err=
2019/07/26 21:23:48 DEBUG : /: >Opendir: errc=0, fh=0x0
2019/07/26 21:23:48 DEBUG : /: Releasedir: fh=0x0
2019/07/26 21:23:48 DEBUG : /: >Releasedir: errc=0
2019/07/26 21:23:48 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/07/26 21:23:48 DEBUG : /: >Getattr: errc=0
2019/07/26 21:23:48 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/07/26 21:23:48 DEBUG : /: >Getattr: errc=0
2019/07/26 21:23:48 DEBUG : /: Opendir:
2019/07/26 21:23:48 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2019/07/26 21:23:48 DEBUG : /: >OpenFile: fd=/ (r), err=
2019/07/26 21:23:48 DEBUG : /: >Opendir: errc=0, fh=0x0
2019/07/26 21:23:48 DEBUG : /: Releasedir: fh=0x0
2019/07/26 21:23:48 DEBUG : /: >Releasedir: errc=0
2019/07/26 21:23:49 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/07/26 21:23:49 DEBUG : /: >Getattr: errc=0
2019/07/26 21:23:49 DEBUG : /: Getattr: fh=0xFFFFFFFFFFFFFFFF
2019/07/26 21:23:49 DEBUG : /: >Getattr: errc=0
2019/07/26 21:23:49 DEBUG : /: Opendir:
2019/07/26 21:23:49 DEBUG : /: OpenFile: flags=O_RDONLY, perm=-rwxrwxrwx
2019/07/26 21:23:49 DEBUG : /: >OpenFile: fd=/ (r), err=
2019/07/26 21:23:49 DEBUG : /: >Opendir: errc=0, fh=0x0
2019/07/26 21:23:49 DEBUG : /: Releasedir: fh=0x0
2019/07/26 21:23:49 DEBUG : /: >Releasedir: errc=0

So I re-ran rclone config to get a new access token and then copied the gcrypt portion into the new rclone.config. Any idea why I had to go through this process again?

Seems like someone/something pulled the credentials. For Google, the keys refresh every hour I believe so it happens quite frequently.

You shouldn't have to do anything for that to happen.

I'd remove allow-non-empty from your mount as it allows for over mounting and running multiple rclones on the same mount point which is not a good thing.

size-only doesn't do anything on a mount so it can be removed.

Are you using the cache backend as well?

dir-cache-time 2m is not a good Google setting as you really want that to be a big number like 96 hours or something. If you are using the cache backend, the info_age needs to be bigger than dir-cache-time as well.

If you are using the cache backend, set buffer-size to 0M.

vfs-cache-max-age - you can remove this if you are not using any vfs-cache-mode as I don't see that in your command line.

--vfs-read-chunk-size-limit" "5G" and -vfs-read-chunk-size" "100M can be left as the defaults to so I'd just remove them.

@Animosity022

I'm not using a cache backend as I opted to use VFS cache instead. This is being used strictly for Plex and is mounted at 2 locations, my Plex server and my seedbox. I have another mount point for some encrypted backups on another server
I have vfs-cache-mode set to minimal in the current config.
Am I not using the proper vfs-cache settings to for streaming files from gdrive? I've tried to gather settings from several sources as there doesn't seem to be a set best practices that I could find.

Edit: I updated my mount command slightly

rclone mount --allow-other --timeout 1h --cache-dir F:\rclone_cache --dir-cache-time 96h --vfs-cache-max-age 4h --vfs-read-chunk-size 128M --vfs-read-chunk-size-limit 5G --drive-chunk-size 128M --buffer-size 512M --vfs-cache-mode writes gcrypt:Media/ T:

"Best" is a bit tough as everyone's setup is a bit different. Like for me, I don't directly write to my rclone mount as I use mergerfs instead as it does a few things for me that make my setup work well with Sonarr and Radarr.

That looks fine and if it's streaming/working. I'd stick with it. My overall goal is always simple and use defaults if that works and only change if needed.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.