Bad Request error from request - NameConflictBehavior must be fail, replace or rename

Hello,

since switching to v2.0.4.35-2.0.4.35_canary_2019-11-29 I get the error message below when doing a job to backup to sharepoint (with version v2.0.4.34-2.0.4.34_canary_2019-11-05 the job still worked):

Failed: Mindestens ein Fehler ist aufgetreten.
Details: System.AggregateException: Mindestens ein Fehler ist aufgetreten. ---> System.AggregateException: The channel "BackendRequests" is retired ---> CoCoL.RetiredException: The channel "BackendRequests" is retired
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei CoCoL.Channel`1.<WriteAsync>d__32.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.BackupHandler.<FlushBackend>d__19.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.BackupHandler.<RunAsync>d__20.MoveNext()
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei Duplicati.Library.Main.Operation.BackupHandler.<RunAsync>d__20.MoveNext()
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei CoCoL.ChannelExtensions.WaitForTaskOrThrow(Task task)
   bei Duplicati.Library.Main.Controller.<>c__DisplayClass14_0.<Backup>b__0(BackupResults result)
   bei Duplicati.Library.Main.Controller.RunAction[T](T result, String[]& paths, IFilter& filter, Action`1 method)
---> (Interne Ausnahme #0) System.AggregateException: The channel "BackendRequests" is retired ---> CoCoL.RetiredException: The channel "BackendRequests" is retired
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei CoCoL.Channel`1.<WriteAsync>d__32.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.BackupHandler.<FlushBackend>d__19.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.BackupHandler.<RunAsync>d__20.MoveNext()
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei Duplicati.Library.Main.Operation.BackupHandler.<RunAsync>d__20.MoveNext()
---> (Interne Ausnahme #0) CoCoL.RetiredException: The channel "BackendRequests" is retired
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei CoCoL.Channel`1.<WriteAsync>d__32.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.BackupHandler.<FlushBackend>d__19.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.BackupHandler.<RunAsync>d__20.MoveNext()<---

---> (Interne Ausnahme #1) System.AggregateException: Mindestens ein Fehler ist aufgetreten. ---> Duplicati.Library.Backend.MicrosoftGraph.MicrosoftGraphException: BadRequest: Bad Request error from request https://graph.microsoft.com/v1.0/sites/tennantid.sharepoint.com,8bxx9dce-8dda-4525-89f2-4c76xxc111d3,f3c56789-7db5-4b8c-8c82-7f2a69xx2563/drive/root:/Pseudoserver/duplicati-bcde989c8f26048e2a20af8e5f2d7bc00.dblock.zip:/createUploadSession
Method: POST, RequestUri: 'https://graph.microsoft.com/v1.0/sites/tennantid.sharepoint.com,8b7f9dce-8dda-4525-89f2-4c765cxx11d3,f3c56789-7db5-4b8c-8c82-7xxa691e2563/drive/root:/Pseudoserver/duplicati-bcde989c8f26048e2a20af8e5f2d7bc00.dblock.zip:/createUploadSession', Version: 1.1, Content: System.Net.Http.StringContent, Headers:
{
  User-Agent: Duplicati/2.0.4.35
  Authorization: Bearer ABC...XYZ
  Content-Type: application/json; charset=utf-8
  Content-Length: 56
}
StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  request-id: 4abd6480-752f-4d19-a855-b61952419de9
  client-request-id: 4abd6480-752f-4d19-a855-b61952419de9
  x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"001","RoleInstance":"AGSFE_IN_22"}}
  Strict-Transport-Security: max-age=31536000
  Cache-Control: private
  Date: Sat, 30 Nov 2019 10:29:49 GMT
  Content-Length: 252
  Content-Type: application/json
}
{
  "error": {
    "code": "invalidRequest",
    "message": "NameConflictBehavior must be fail, replace or rename",
    "innerError": {
      "request-id": "4abd6480-752f-4d19-a855-b61952419de9",
      "date": "2019-11-30T10:29:49"
    }
  }
}
   bei Duplicati.Library.Backend.MicrosoftGraphBackend.CheckResponse(HttpResponseMessage response)
   bei Duplicati.Library.Backend.MicrosoftGraphBackend.ParseResponse[T](HttpResponseMessage response)
   bei Duplicati.Library.Backend.MicrosoftGraphBackend.<PutAsync>d__54.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<DoPut>d__21.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<>c__DisplayClass17_0.<<UploadFileAsync>b__0>d.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<DoWithRetry>d__18.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<DoWithRetry>d__18.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<UploadFileAsync>d__17.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<UploadBlockAndIndexAsync>d__15.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<<Run>b__13_0>d.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<<Run>b__13_0>d.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei CoCoL.AutomationExtensions.<RunTask>d__10`1.MoveNext()
   --- Ende der internen Ausnahmestapelüberwachung ---
---> (Interne Ausnahme #0) Duplicati.Library.Backend.MicrosoftGraph.MicrosoftGraphException: BadRequest: Bad Request error from request https://graph.microsoft.com/v1.0/sites/tennantid.sharepoint.com,8b7f9dce-8dda-4525-89f2-4c765cc111d3,f3c56789-7db5-4b8c-8c82-7f2a691e2563/drive/root:/Pseudoserver/duplicati-bcde989c8f26048e2a20af8e5f2d7bc00.dblock.zip:/createUploadSession
Method: POST, RequestUri: 'https://graph.microsoft.com/v1.0/sites/tennantid.sharepoint.com,8b7f9dce-8dda-4525-89f2-4c765cc111d3,f3c56789-7db5-4b8c-8c82-7f2a691e2563/drive/root:/Pseudoserver/duplicati-bcde989c8f26048e2a20af8e5f2d7bc00.dblock.zip:/createUploadSession', Version: 1.1, Content: System.Net.Http.StringContent, Headers:
{
  User-Agent: Duplicati/2.0.4.35
  Authorization: Bearer ABC...XYZ
  Content-Type: application/json; charset=utf-8
  Content-Length: 56
}
StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  request-id: 4abd6480-752f-4d19-a855-b61952419de9
  client-request-id: 4abd6480-752f-4d19-a855-b61952419de9
  x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"001","RoleInstance":"AGSFE_IN_22"}}
  Strict-Transport-Security: max-age=31536000
  Cache-Control: private
  Date: Sat, 30 Nov 2019 10:29:49 GMT
  Content-Length: 252
  Content-Type: application/json
}
{
  "error": {
    "code": "invalidRequest",
    "message": "NameConflictBehavior must be fail, replace or rename",
    "innerError": {
      "request-id": "4abd6480-752f-4d19-a855-b61952419de9",
      "date": "2019-11-30T10:29:49"
    }
  }
}
   bei Duplicati.Library.Backend.MicrosoftGraphBackend.CheckResponse(HttpResponseMessage response)
   bei Duplicati.Library.Backend.MicrosoftGraphBackend.ParseResponse[T](HttpResponseMessage response)
   bei Duplicati.Library.Backend.MicrosoftGraphBackend.<PutAsync>d__54.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<DoPut>d__21.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<>c__DisplayClass17_0.<<UploadFileAsync>b__0>d.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<DoWithRetry>d__18.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<DoWithRetry>d__18.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<UploadFileAsync>d__17.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<UploadBlockAndIndexAsync>d__15.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<<Run>b__13_0>d.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Duplicati.Library.Main.Operation.Backup.BackendUploader.<<Run>b__13_0>d.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei CoCoL.AutomationExtensions.<RunTask>d__10`1.MoveNext()<---
<---
<---


Log data:
2019-11-30 11:29:49 +01 - [Error-Duplicati.Library.Main.Operation.BackupHandler-FatalError]: Fatal error
CoCoL.RetiredException: The channel "BackendRequests" is retired
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei CoCoL.Channel`1.<WriteAsync>d__32.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.BackupHandler.<FlushBackend>d__19.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Duplicati.Library.Main.Operation.BackupHandler.<RunAsync>d__20.MoveNext()

Many greetings
Oliver

Hello,

I had 4 jobs (4 different computers, Sharepoint V2) affected. After switching back to version .34 the jobs work again.

Many greetings
Oliver

My guess is that for SharePoint, the ConflictBehavior enums string value must be case sensitive, since the value given should always be “Replace”, though “replace” is listed as one of the allowed values. The fix should be to make sure the serialized value is always lowercase (possibly by removing the upper case value from the enum). Alternatively, we could remove the explicit ConflictBehavior since the default should be replace anyway (and that would align with the previous behavior).

Strange that my testing against OneDrive didn’t catch this. OneDrive must not care about the casing.

How do we resolve this? First, perhaps ask for more details about SharePoint because it has so many forms (and I’m not an expert). Is this cloud-based Sharepoint, maybe as part of OneDrive for Business as was mentioned in 2018 (or maybe Office 365 Business)? I don’t know if a test account is possible…

Alternatively, test builds might be possible, but there are no official nightly builds. Canary is as needed. This would be a good issue to clear up soon, because it may be the final block to going towards Beta…

I successfully backed up with .34 from four computers every day this week. Today I successfully backed up a PC with .34. Then update… immediately after that I backed up with .35 installed. With this job the error came immediately again.

My settings - see below.

What other information can I provide?

You probably need to work with @tygill and possibly @kenkendk (who has very little time) directly.

Is yours the sort of Microsoft plan where you can make a test user and PM it to somebody to debug?

I could ask around more to see if anyone has a plan like yours. What exactly is it, in Microsoft terms? Generally, my impression is that Business plans (many exist) use SharePoint technology underneath.

If you are willing to do some more tests, I suppose you could see what happens when doing things in Duplicati.CommandLine.BackendTool.exe, probably starting with URL from Export As Command-line and ultimately making it a possibly simpler test than that variety of operations that the Backup can do.

Duplicati.CommandLine.BackendTester.exe can be pointed to an empty folder to do automated tests, however that potentially removes the fine control that one can have when using BackendTool instead.

Affected: Office 365 Business Premium

Yes, I am willing to do some more tests. Yes, I can provide a test environment. I need a few days to do this and then get back to you.

I’m pretty sure the problem is just the enum casing and that the fix would be to not specify the conflict resolution at all (as was happening before). Unfortunately, I’m not going to be at a computer where I can make the change for several weeks.

No problem @tygill. If you don’t mind, I can submit a pull request to revert the changes from pull request #3989. This way, we can release a canary with a working Sharepoint and a fix for stopping backups.

Alternatively, I think I can see the fix that @tygill was suggesting. @ollibraun, if you are able to create a test environment that I can use, I can test the proposed fix.

I wonder what the risk is of other surprises from this? We’d really like to replace the 13-month-old Beta code soon, so need to get kind of selective about what gets in, otherwise, there’s never a good point…

Assuming Canary finally seems settled down, then an Experimental happens, then finally there’s Beta, which to some extent (maybe after a bit of a wait) opens the master branch up to less urgent changes.

Thanks to @warwickmm for offering to work with @tygill and thanks to @ollibraun for account help.

@warwickmm - I’m fine with you making the change. The behavioral fix is simply to remove the using line around line 361 where createSessionRequest.Content is set (since the old behavior didn’t have that content being set, even though a content object was created). The documented default is replace, so this was redundant anyway (mostly intended as marking the default explicitly).

Thanks for confirming @tygill. I’ll make the change (and run some OneDrive tests) and create the pull request.

@ts678, the remaining changes from pull request #3989 appear to to just dispose of unused resources, so I think they should be safe to keep. We are reverting the only logical change. Since this is the last change blocking the beta, we can hopefully quickly iterate as needed if something comes up (and hold off on merging any other pull requests).

Pull request submitted. @tygill, this simply removes the using line. Below is the patch:

diff --git a/Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs b/Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs
index a01b84976..1983d43e1 100644
--- a/Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs
+++ b/Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs
@@ -357,8 +357,6 @@ namespace Duplicati.Library.Backend
                 // but also states that the nextExpectedRanges value returned may indicate multiple ranges...
                 // For now, this plays it safe and does a sequential upload.
                 using (HttpRequestMessage createSessionRequest = new HttpRequestMessage(HttpMethod.Post, string.Format("{0}/root:{1}{2}:/createUploadSession", this.DrivePrefix, this.RootPath, NormalizeSlashes(remotename))))
-                /* Indicate that we want to replace any existing content with this new data we're uploading */
-                using (createSessionRequest.Content = this.PrepareContent(new UploadSession() { Item = new DriveItem() { ConflictBehavior = ConflictBehavior.Replace } }))
                 {
                     using (HttpResponseMessage createSessionResponse = await m_client.SendAsync(createSessionRequest, cancelToken).ConfigureAwait(false))
                     {

A fix has been merged and should appear in the next release.

@ollibraun, version 2.0.4.36 should hopefully fix this issue.

Back from journey… oh, you’ve already solved the problem! A test environment is no longer necessary, I think.

The broken backup with version 2.0.4.35 works again, after I installed version 2.0.4.36.

On the other Sharepoint backups I also updated to 2.0.4.36. They still work.

Thank you very much for your work! Version 2.0.4.36 looks very good (NAS, S3, Sharepoint V2, FTP).

1 Like

I think the removal of intended code was not meant to be the final fix, so maybe you could help later on. Perhaps some developer will ask again, when the time comes to continue on originally intended path…

1 Like