Tuesday, January 8, 2013

Google Drive still unreliable (How to fix 'Primary key must be unique' error)

I hate Google Drive. It is haunted by too many bugs. 

Recently my GDrive application started showing a "primary key must be unique" error message, asking me to disconnect the drive and start all over again. I did that. Took few hours to resynchronize it all. But the next day I got the same error and asked me again to repeat the operation. I have been poking the forums (including Google's forum) up and down for months and found no real solution. So I had to do the job on my own. This is how to fix the "primary key must be unique" error:

  1. Start Google Drive
  2. Hold the SHIFT key pressed while clicking the Google Drive systray icon. This will show the 'Enable diagnostic mode' special menu.
  3. Click 'Enable diagnostic mode' menu.
  4. Wait until Google Drive crashes and shows the "primary key must be unique"error message. Let the application shutdown.
  5. Go to "c:\Users\YOUR_USER_NAME\AppData\Local\Google\Drive" folder and open "sync_log.log".
    Note: Replace 'YOUR_USER_NAME' with your Windows account name (the account in which you are logged in). You can see this name when you press the 'Start' button.
  6. Look up this text: "Detected conflict while trying to download file to".
  7. After 'to' follows the name of the file that generated the conflict. Locate that file and delete it or (better) rename it. Do this for all conflicted files (if there are more than one).
  8. Restart Google Drive.
    That's it.
This technique can be used to debug other Google Drive errors also.

Update 1 - How to do it on Mac OS (thanks to Maik):

Thanks, this fix also works for Apple Mac OS-X.
To get to the log file:
- in finder click the Go menu
- with the menu open click ALT-key so the hidden Library item appears
- open the Library and go to folder Google -> Drive

Update 2 - More GDrive bugs: The trash cannot be purged

Now my Google Drive account shows that is 95% full even if I don't have many files loaded in GDrive (I have a total of 1.1GB). After investigation I have discovered that are files locked in the 'Trash' that cannot be deleted. I contacted Google Drive support and they said they will fix my account. The provided additional Google Drive space so I can keep using my GDrive until they will fix the problem. That was in February 2012. Still no word from them.

Update 3 - How to make GDrive synchronize faster?

How to improve the Google Drive synchronize speed?


With this occasion I want to thanks Google team for the fucking 'good' job they did and to tell them: I don't believe in witches, but they surely exist. 



  1. Thank you very much for sharing your knowledge!
    This was the second time in 3 months I got this error and your solutions worked fine!

  2. Your solution worked great! I'll definitely be scanning this huge sync log from now on. Thanks.

  3. It worked like a charm! Thank you VERY much for sharing this, it was a nightmare going thru all this all the time... Thank you. Thank you. Thank you.

  4. Keeps happening. How can a good company s*ck that much? Makes me wonder. Thanks for your post.

  5. Let's all hope that Google will release a decent GDrive version soon.

  6. Thanks, this fix also works for Apple Mac OS-X.
    To get to the log file:
    - in finder click the Go menu
    - with the menu open click ALT-key so the hidden Library item appears
    - open the Library and go to folder Google -> Drive

    Best regards,

  7. Thanks a lot for this. Solved the problem easily.

  8. I can confirm this does the job also in the german version of google drive. After ~10x re-syncing 3GB in the last month, this should now be over.

    As for my files, a stock monitor file caused the problem. Maybe it wrote data to GDrive when shutting the PC down - after the Google service was terminated? Since I now got a hint, I will close this application before shutting down the PC and hope the problem won´t come again.

  9. thank you very much! this work for me!

  10. Hi, thanks for posting this. After Step 3 I get a box saying "Start Logging" and a "Log Level" dropdown box saying either "Info" or "Debug". Should I "Start Logging" and which of the dropdown options should I choose?
    Thank you!!!

  11. Yes.
    You need to start logging.
    Let is log until after you see the error you want to monitor. Then stop the logging and investigate the log.

    'Info' shows less text in the log. It is easier to investigate.
    'Debug' shows maximum amount of info. More accurate. You need more patience to investigate the log.
    I would go for debug.

  12. Thank you so much!, I have gotten this error many times and this was the first that I was able to recover without re-downloading all my files.