# Random IO Error 401: Invalid Credentials

**URL:** <https://forum.rclone.org/t/random-io-error-401-invalid-credentials/11024>\
**Category:** Help and Support\
**Created:** [July 27, 2019, 4:25am UTC](https://forum.rclone.org/t/random-io-error-401-invalid-credentials/11024 "2019-07-27T04:25:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![truncsphere](https://forum.rclone.org/user_avatar/forum.rclone.org/truncsphere/32/3212_2.png) [@truncsphere](https://forum.rclone.org/u/truncsphere)\
**Post date:** [July 27, 2019, 4:25am UTC](https://forum.rclone.org/t/random-io-error-401-invalid-credentials/11024/1 "2019-07-27T04:25:32Z")

</div>

#### 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

---

<div class="post-metadata">

**Author:** ![truncsphere](https://forum.rclone.org/user_avatar/forum.rclone.org/truncsphere/32/3212_2.png) [@truncsphere](https://forum.rclone.org/u/truncsphere)\
**Post date:** [July 27, 2019, 4:35am UTC](https://forum.rclone.org/t/random-io-error-401-invalid-credentials/11024/2 "2019-07-27T04:35:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [July 28, 2019, 2:52pm UTC](https://forum.rclone.org/t/random-io-error-401-invalid-credentials/11024/3 "2019-07-28T14:52:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![truncsphere](https://forum.rclone.org/user_avatar/forum.rclone.org/truncsphere/32/3212_2.png) [@truncsphere](https://forum.rclone.org/u/truncsphere)\
**Post date:** [July 28, 2019, 3:36pm UTC](https://forum.rclone.org/t/random-io-error-401-invalid-credentials/11024/4 "2019-07-28T15:36:28Z")

</div>

@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:

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [July 28, 2019, 4:29pm UTC](https://forum.rclone.org/t/random-io-error-401-invalid-credentials/11024/5 "2019-07-28T16:29:11Z")

</div>

"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.

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [October 26, 2019, 4:29pm UTC](https://forum.rclone.org/t/random-io-error-401-invalid-credentials/11024/6 "2019-10-26T16:29:15Z")

</div>

Closed on October 26, 2019, 4:29pm UTC

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