An open collection of noteworthy things


GSync: Fixing “HttpError 400 The Provided File ID is not Usable”

GSync is a nice little utility to sync files/directories/etc to or from your Google Drive. However, when we install it:

sudo apt-get install python-setuptools
sudo easy_install pip
sudo pip install gsync

…we may encounter a problem when actually trying to sync our files! When syncing (pushing) a local directory recursively to our Google Drive (gsync --progress -r localdir/ drive:///remotedir), only directories seem to be created – no files within them, however.

Digging a little deeper, if we run gsync --debug -r localdir/ drive:///remotedir, we’ll notice that the following seems to come up occasionally:

Creation failed: <HttpError 400 when requesting returned "The provided file ID is not usable">

This, as it turns out, is our problem. GSync can’t seem to create the files it’s trying to create.

This is a good temporary solution, though GSync won’t now like it if the filename ends in ~

The solution:


sudo nano /usr/local/lib/python2.7/dist-packages/libgsync/drive/

then we find the line where body = {} is located (search with Ctrl + W), and the following code should be just under it:

for k, v in properties.iteritems():
     body[k] = _Drive.utf8(v)

We need to change this to the following:

for k, v in properties.iteritems():
     if v is not None:
         body[k] = _Drive.utf8(v)

The line we need to add is highlighted in red – do note that this needs to be indented properly.

After we’ve made the modification, you can exit nano (saving your changes) by pressing Ctrl + X, then Y, then Enter. Now when we run gsync --progress -r localdir/ drive:///remotedir, it should work!

(if you have a large number of files, or files of a large size, to sync then you may want to run the command in screen – you’ll thank me later 🙂 )