From b31659904fdccf7de4585589c08ab8a0a41185d3 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 8 May 2025 16:58:52 +0100 Subject: [PATCH] onedrive: fix "The upload session was not found" errors Before this change, sometimes, perhaps on heavily loaded sharepoint servers, uploads would sometimes fail with the error: {"error":{"code":"itemNotFound","message":"The upload session was not found"}} This retries the upload after a 5 second delay up to --low-level-retries times. Fixes #8545 --- backend/onedrive/onedrive.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go index bfa6ce61c..c1a13f654 100644 --- a/backend/onedrive/onedrive.go +++ b/backend/onedrive/onedrive.go @@ -2469,6 +2469,10 @@ func (o *Object) uploadFragment(ctx context.Context, url string, start int64, to return false, nil } return true, fmt.Errorf("retry this chunk skipping %d bytes: %w", skip, err) + } else if err != nil && resp != nil && resp.StatusCode == http.StatusNotFound { + fs.Debugf(o, "Received 404 error: assuming eventual consistency problem with session - retrying chunk: %v", err) + time.Sleep(5 * time.Second) // a little delay to help things along + return true, err } if err != nil { return shouldRetry(ctx, resp, err)