yadayada / acd_cli

An unmaintained command line interface and FUSE filesystem for Amazon (Cloud) Drive
Other
1.35k stars 165 forks source link

RequestError: 409, "code":"NAME_ALREADY_EXISTS" on acd_cli create or mkdir #463

Closed jerblack closed 8 years ago

jerblack commented 8 years ago

I have a script that is doing automatic uploads to ACD using ACD_CLI, but I recently started getting errors when attempting to create folder paths before an upload. The error I'm getting is RequestError 409 NAME_ALREADY_EXISTS. I don't think it's possible for it to be a cache out of sync issue since I am manually deleting your database before I sync and it still happens. To be clear, these are the steps I take to see this error:

  1. Remove every file except oauth_data from .cache/acd_cli
  2. Run the following
acd_cli sync
acd_cli create backup/LnLqMsdfgsdXwd,A5Xvktui,thU/6OYEdX29Ywrbtertr,md5kcCf/fzk1mHvyic-cLjceNqwertbebdpz1G4-Jx0,2p,Jl52w-qZ,

Then I get this error:

16-10-28 13:26:12.225 [WARNING] [acd_cli] - Node "fzk1mHvyic-cLjceNqwertbebdpz1G4-Jx0,2p,Jl52w-qZ,," already exists. 
RequestError: 409, {
"code":"NAME_ALREADY_EXISTS",
"logref":"c479ca84-9d4c-11e6-a6f0-ddfbb612694b",
"message":"Node with the name fzk1mHvyic-cLjceNqwertbebdpz1G4-Jx0,2p,Jl52w-qZ, already exists under parentId LasdfabtQneH-YE5tMrqOA conflicting NodeId: CE4HS-9oS7qtmysnJ0Ezs-g5hA",
"info":{"nodeId":"CE4HS-9oSimt4Ezs-g5hA"}}

When I attempt to acd_cli ls the same folder, I get

16-10-28 13:36:34.758 [CRITICAL] [acd_cli] - Could not resolve path "/backup/LnLqMfkN9Xwd,A5XFCSsSihU/6OYEdX29YEjHuGV8,md5kcCf/fzk1mHvyic-cLjceNqYzCP1dpz1G4-Jx0,2p,Jl52w-qZ,".

This folder is not visible from an acd_cli mount on another machine, but it is visible from the web interface. From the web interface, If I move the files out of that folder, delete and recreate the folder with the same same, and then attempt acd_cli create against that new folder (yes, I know it already exists at that point) then the result looks much more reasonable: 16-10-28 13:26:12.800 [WARNING] [acd_cli] - Folder "fzk1mHvyic-cLjceNqwertbebdpz1G4-Jx0,2p,Jl52w-qZ," already exists.

What is causing this? I also ran the same cmds with -v -d, but the output contained way too much PII and auth info to post in a public forum like this.

bgemmill commented 8 years ago

Check your logs to see if the sync you're calling completes; you really should keep the nodes.db around since removing it may require the far slower old-sync to complete.

If sync doesn't complete, your acdcli will be left not knowing about things that exist on Amazon.

jerblack commented 8 years ago

For my script, deleting the db ended up being the only way to reliably fix problems with sync failing to complete after multiple attempts, even after running acd_cli cc. Sync speed isn't really an issue since everything is automated and on my connection, a sync after deleting the db still only takes a few seconds. I have one script encrypting and uploading 10s of TB to ACD and two unlimited Google Drive accounts simultaneously, so it's running for days on end, and it's more important that it run without interruption than the sync being as fast as possible.

On Tue, Nov 1, 2016 at 4:38 PM, bgemmill notifications@github.com wrote:

Check your logs to see if the sync you're calling completes; you really should keep the nodes.db around since removing it may require the far slower old-sync to complete.

If sync doesn't complete, your acdcli will be left not knowing about things that exist on Amazon.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yadayada/acd_cli/issues/463#issuecomment-257731447, or mute the thread https://github.com/notifications/unsubscribe-auth/AFgPXmEhLqjVvP31Q68WXi1NlOuntebRks5q581ngaJpZM4Kj2nK .

bgemmill commented 8 years ago

If sync doesn't complete, you should run old-sync to get your nodes.db. Then, definitely keep that nodes.db around, you'll find that after some time (Amazon likely has a backoff) normal sync will start working again.

Deleting nodes.db can cause a lot of issues like this. During development of my PR, I was deleting nodes.db often while getting the database schema right. Amazon must have had some backoff check since after a while normal sync didn't work for me. I used old-sync, kept the nodes.db around, and after a week it came back.

Definitely keep the nodes around.

jerblack commented 8 years ago

Thanks for letting me know about old-sync. That seems to be more predictable, and has resolved my name collision issues.