2025 sparked some incredible conversations across our community đ©âđ». Discover the highlights and see whatâs ahead in 2026.
Forum Discussion
donaldp
3 years agoCollaborator | Level 9
Trying to get dotnet batch upload working (to solve "too many operations" issue)
Hi, I'm saving a lot of log files from parallel process and running into "too many operations" exceptions occasionally (I already rate-limited them to 1 per second start rate to deal with a ra...
Greg-DB
Dropbox Community Moderator
3 years agoFirst, for reference, if there are multiple changes at the same time in the same account or shared folder, you can run in to the 'too_many_write_operations' error, which is "lock contention". That's not explicit rate limiting, but rather a result of how Dropbox works on the back-end. This is a technical inability to make a modification in the account or shared folder at the time of the API call. This error indicates that there was simultaneous activity in the account or shared/team folder preventing your app from making the state-modifying call (e.g., adding, editing, moving, copying, sharing, or deleting files/folders) it is attempting. The simultaneous activity could be coming from your app itself, or elsewhere, e.g., from the user's desktop client. It can come from the same user, or another member of a shared folder. You can find more information about lock contention here.
In short, to avoid this error, you should avoid making multiple concurrent state modifications and use batch endpoints where possible. That won't guarantee that you won't run in to this error though, as contention can still come from other sources, so you should also implement error handling and automatic retrying as needed.
I also recommend referring to the error documentation and Error Handling Guide for more information.
Looking at your code, I see you are using UploadSessionFinishBatchAsync to commit multiple files in a batch, which is good and can help avoid lock contention. Likewise though, make sure you're only running one WriteBatchOfFilesAsync at a time though (that is, effectively one UploadSessionFinishBatchAsync job at a time), otherwise they may conflict with each other.
Also, the offset for any particular upload session (that is, for any particular file that you're uploading), should be however much data you've uploaded to that upload session for that file so far. So, unless you are intending to exclusively upload empty files, you should not be setting your offset to 0 as you have in this code, nor should you be setting it to the current size of the file on the Dropbox servers, if any, as you have in the commented out version of the code. Since you're just using one UploadSessionStartAsync call per file, it would be the size of the file data you're passing to that, which you have as StringToStream(file.Content). (Also, make sure StringToStream(file.Content) is returning the data you expect it to.)
Once you do have UploadSessionFinishBatchJobStatus.Complete, you should check each UploadSessionFinishBatchResultEntry in UploadSessionFinishBatchResult.Entries, to see whether each one succeeded or failed, and why.
donaldp
3 years agoCollaborator | Level 9
Hi Greg,
There are no concurrent operations - I'm running this standalone (I'm still just testing it), so it's definitely not that.
> Also, make sure StringToStream(file.Content) is returning the data you expect it to
No, I hadn't checked that actually, so that's one thing I can look at.
> you should check each UploadSessionFinishBatchResultEntry in UploadSessionFinishBatchResult.Entries, to see whether each one succeeded or failed, and why
Ah, yes I had missed that (a lot to take in with making this run in batches)! I thought "IsComplete" meant it worked, but that's an incorrect assumption. I'll look at those 2 things and hopefully it'll work. Thanks! đ
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!