Nextcloud + S3 : Deletion not allowed + sync blocked

Nextcloud Hub II (23.0.5)
docker image: nextcloud:production-apache
Traefik
PHP 8.0.19

The issue you are facing:

Client has no right on files. it can not delete files and sync is stoped. I am not sure if the probleme is on nextcloud or on S3 config. the only thing I know it that the message is new (Since one week ago, I think). There has been update on nextcloud and minio.

Is this the first time you’ve seen this error? : Y

Steps to replicate it: Sync from clients (windows, android and apple).

The output of your Nextcloud log in Admin > Logging:
I put logs from a windows client.
Log formated:

[objectstore] Erreur: Could not delete object urn:oid:641838 for uploads/2666709409/0000000000000000

DELETE /remote.php/dav/uploads/user001/2666709409
from 2a01:cb00:54:7c00:85bc:5cb1:cdae:fc07 by user001 at 2022-06-07T04:49:58+00:00

Log not formated:

{
  "reqId": "iFcKSg7dS7B65fkNiEHn",
  "level": 3,
  "time": "2022-06-07T04:49:58+00:00",
  "remoteAddr": "xxxx:xxxx:xxxx::",
  "user": "user001",
  "app": "objectstore",
  "method": "DELETE",
  "url": "/remote.php/dav/uploads/user001/2666709409",
  "message": "Could not delete object urn:oid:641838 for uploads/2666709409/0000000000000000",
  "userAgent": "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.22000 ClientArchitecture: x86_64 OsArchitecture: x86_64)",
  "version": "23.0.5.1",
  "exception": {
    "Exception": "Aws\\S3\\Exception\\S3Exception",
    "Message": "Error executing \"DeleteObject\" on \"https://s3.url.fr/nextcloud/urn%3Aoid%3A641838\"; AWS HTTP error: Client error: `DELETE https://s3.url.fr/nextcloud/urn%3Aoid%3A641838` resulted in a `400 Bad Request` response:\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>InvalidRequest</Code><Message>Object is WORM protected and cannot be (truncated...)\n InvalidRequest (client): Object is WORM protected and cannot be overwritten - <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>InvalidRequest</Code><Message>Object is WORM protected and cannot be overwritten</Message><Key>urn:oid:641838</Key><BucketName>nextcloud</BucketName><Resource>/nextcloud/urn:oid:641838</Resource><Region>fr</Region><RequestId>16F63D60C2C0A5A5</RequestId><HostId>1c9b6dcf-b244-42b8-b250-e8c4bdf68e55</HostId></Error>",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/3rdparty/aws/aws-sdk-php/src/WrappedHttpHandler.php",
        "line": 97,
        "function": "parseError",
        "class": "Aws\\WrappedHttpHandler",
        "type": "->",
        "args": [
          "*** sensitive parameter replaced ***",
          {
            "__class__": "GuzzleHttp\\Psr7\\Request"
          },
          {
            "__class__": "Aws\\Command"
          },
          []
        ]
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 204,
        "function": "Aws\\{closure}",
        "class": "Aws\\WrappedHttpHandler",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 169,
        "function": "callHandler",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "::",
        "args": [
          2,
          "*** sensitive parameter replaced ***",
          null
        ]
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/RejectedPromise.php",
        "line": 42,
        "function": "GuzzleHttp\\Promise\\{closure}",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php",
        "line": 48,
        "function": "GuzzleHttp\\Promise\\{closure}",
        "class": "GuzzleHttp\\Promise\\RejectedPromise",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php",
        "line": 158,
        "function": "run",
        "class": "GuzzleHttp\\Promise\\TaskQueue",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php",
        "line": 183,
        "function": "tick",
        "class": "GuzzleHttp\\Handler\\CurlMultiHandler",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 248,
        "function": "execute",
        "class": "GuzzleHttp\\Handler\\CurlMultiHandler",
        "type": "->",
        "args": [
          true
        ]
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 224,
        "function": "invokeWaitFn",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 269,
        "function": "waitIfPending",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 226,
        "function": "invokeWaitList",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 269,
        "function": "waitIfPending",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 226,
        "function": "invokeWaitList",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
        "line": 62,
        "function": "waitIfPending",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/aws/aws-sdk-php/src/AwsClientTrait.php",
        "line": 58,
        "function": "wait",
        "class": "GuzzleHttp\\Promise\\Promise",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/aws/aws-sdk-php/src/AwsClientTrait.php",
        "line": 86,
        "function": "execute",
        "class": "Aws\\AwsClient",
        "type": "->",
        "args": [
          {
            "__class__": "Aws\\Command"
          }
        ]
      },
      {
        "file": "/var/www/html/lib/private/Files/ObjectStore/S3ObjectTrait.php",
        "line": 167,
        "function": "__call",
        "class": "Aws\\AwsClient",
        "type": "->",
        "args": [
          "deleteObject",
          [
            {
              "Bucket": "nextcloud",
              "Key": "urn:oid:641838"
            }
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php",
        "line": 210,
        "function": "deleteObject",
        "class": "OC\\Files\\ObjectStore\\S3",
        "type": "->",
        "args": [
          "urn:oid:641838"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php",
        "line": 192,
        "function": "unlink",
        "class": "OC\\Files\\ObjectStore\\ObjectStoreStorage",
        "type": "->",
        "args": [
          "uploads/2666709409/0000000000000000"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php",
        "line": 175,
        "function": "rmObjects",
        "class": "OC\\Files\\ObjectStore\\ObjectStoreStorage",
        "type": "->",
        "args": [
          "uploads/2666709409"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php",
        "line": 94,
        "function": "rmdir",
        "class": "OC\\Files\\ObjectStore\\ObjectStoreStorage",
        "type": "->",
        "args": [
          "uploads/2666709409"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php",
        "line": 111,
        "function": "rmdir",
        "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
        "type": "->",
        "args": [
          "uploads/2666709409"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php",
        "line": 94,
        "function": "rmdir",
        "class": "OC\\Files\\Storage\\Wrapper\\Availability",
        "type": "->",
        "args": [
          "uploads/2666709409"
        ]
      },
      {
        "function": "rmdir",
        "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
        "type": "->",
        "args": [
          "uploads/2666709409"
        ]
      },
      {
        "file": "/var/www/html/apps/files_trashbin/lib/Storage.php",
        "line": 193,
        "function": "call_user_func",
        "args": [
          [
            {
              "__class__": "OCA\\Files_Antivirus\\AvirWrapper",
              "cache": {
                "__class__": "OC\\Files\\Cache\\Cache"
              },
              "scanner": null,
              "watcher": null,
              "propagator": null,
              "updater": null
            },
            "rmdir"
          ],
          "uploads/2666709409"
        ]
      },
      {
        "file": "/var/www/html/apps/files_trashbin/lib/Storage.php",
        "line": 125,
        "function": "doDelete",
        "class": "OCA\\Files_Trashbin\\Storage",
        "type": "->",
        "args": [
          "uploads/2666709409",
          "rmdir"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Files/View.php",
        "line": 1171,
        "function": "rmdir",
        "class": "OCA\\Files_Trashbin\\Storage",
        "type": "->",
        "args": [
          "uploads/2666709409"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Files/View.php",
        "line": 350,
        "function": "basicOperation",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          "rmdir",
          "/2666709409",
          [
            "delete"
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php",
        "line": 309,
        "function": "rmdir",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          "/2666709409"
        ]
      },
      {
        "file": "/var/www/html/apps/dav/lib/Upload/UploadFolder.php",
        "line": 80,
        "function": "delete",
        "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php",
        "line": 179,
        "function": "delete",
        "class": "OCA\\DAV\\Upload\\UploadFolder",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
        "line": 281,
        "function": "delete",
        "class": "Sabre\\DAV\\Tree",
        "type": "->",
        "args": [
          "uploads/user001/2666709409"
        ]
      },
      {
        "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "httpDelete",
        "class": "Sabre\\DAV\\CorePlugin",
        "type": "->",
        "args": [
          {
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          }
        ]
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 472,
        "function": "emit",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "method:DELETE",
          [
            {
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            }
          ]
        ]
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 253,
        "function": "invokeMethod",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          {
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          }
        ]
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 321,
        "function": "start",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/apps/dav/lib/Server.php",
        "line": 339,
        "function": "exec",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
        "line": 35,
        "function": "exec",
        "class": "OCA\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/remote.php",
        "line": 166,
        "args": [
          "/var/www/html/apps/dav/appinfo/v2/remote.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/3rdparty/aws/aws-sdk-php/src/WrappedHttpHandler.php",
    "Line": 195,
    "Previous": {
      "Exception": "GuzzleHttp\\Exception\\ClientException",
      "Message": "Client error: `DELETE https://s3.url.fr/nextcloud/urn%3Aoid%3A641838` resulted in a `400 Bad Request` response:\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>InvalidRequest</Code><Message>Object is WORM protected and cannot be (truncated...)\n",
      "Code": 400,
      "Trace": [
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php",
          "line": 69,
          "function": "create",
          "class": "GuzzleHttp\\Exception\\RequestException",
          "type": "::",
          "args": [
            {
              "__class__": "GuzzleHttp\\Psr7\\Request"
            },
            "*** sensitive parameter replaced ***",
            null,
            [],
            null
          ]
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
          "line": 204,
          "function": "GuzzleHttp\\{closure}",
          "class": "GuzzleHttp\\Middleware",
          "type": "::",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
          "line": 153,
          "function": "callHandler",
          "class": "GuzzleHttp\\Promise\\Promise",
          "type": "::",
          "args": [
            1,
            "*** sensitive parameter replaced ***",
            null
          ]
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php",
          "line": 48,
          "function": "GuzzleHttp\\Promise\\{closure}",
          "class": "GuzzleHttp\\Promise\\Promise",
          "type": "::",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php",
          "line": 158,
          "function": "run",
          "class": "GuzzleHttp\\Promise\\TaskQueue",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php",
          "line": 183,
          "function": "tick",
          "class": "GuzzleHttp\\Handler\\CurlMultiHandler",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
          "line": 248,
          "function": "execute",
          "class": "GuzzleHttp\\Handler\\CurlMultiHandler",
          "type": "->",
          "args": [
            true
          ]
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
          "line": 224,
          "function": "invokeWaitFn",
          "class": "GuzzleHttp\\Promise\\Promise",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
          "line": 269,
          "function": "waitIfPending",
          "class": "GuzzleHttp\\Promise\\Promise",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
          "line": 226,
          "function": "invokeWaitList",
          "class": "GuzzleHttp\\Promise\\Promise",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
          "line": 269,
          "function": "waitIfPending",
          "class": "GuzzleHttp\\Promise\\Promise",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
          "line": 226,
          "function": "invokeWaitList",
          "class": "GuzzleHttp\\Promise\\Promise",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php",
          "line": 62,
          "function": "waitIfPending",
          "class": "GuzzleHttp\\Promise\\Promise",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/aws/aws-sdk-php/src/AwsClientTrait.php",
          "line": 58,
          "function": "wait",
          "class": "GuzzleHttp\\Promise\\Promise",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/aws/aws-sdk-php/src/AwsClientTrait.php",
          "line": 86,
          "function": "execute",
          "class": "Aws\\AwsClient",
          "type": "->",
          "args": [
            {
              "__class__": "Aws\\Command"
            }
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/ObjectStore/S3ObjectTrait.php",
          "line": 167,
          "function": "__call",
          "class": "Aws\\AwsClient",
          "type": "->",
          "args": [
            "deleteObject",
            [
              {
                "Bucket": "nextcloud",
                "Key": "urn:oid:641838"
              }
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php",
          "line": 210,
          "function": "deleteObject",
          "class": "OC\\Files\\ObjectStore\\S3",
          "type": "->",
          "args": [
            "urn:oid:641838"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php",
          "line": 192,
          "function": "unlink",
          "class": "OC\\Files\\ObjectStore\\ObjectStoreStorage",
          "type": "->",
          "args": [
            "uploads/2666709409/0000000000000000"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php",
          "line": 175,
          "function": "rmObjects",
          "class": "OC\\Files\\ObjectStore\\ObjectStoreStorage",
          "type": "->",
          "args": [
            "uploads/2666709409"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 94,
          "function": "rmdir",
          "class": "OC\\Files\\ObjectStore\\ObjectStoreStorage",
          "type": "->",
          "args": [
            "uploads/2666709409"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php",
          "line": 111,
          "function": "rmdir",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->",
          "args": [
            "uploads/2666709409"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 94,
          "function": "rmdir",
          "class": "OC\\Files\\Storage\\Wrapper\\Availability",
          "type": "->",
          "args": [
            "uploads/2666709409"
          ]
        },
        {
          "function": "rmdir",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->",
          "args": [
            "uploads/2666709409"
          ]
        },
        {
          "file": "/var/www/html/apps/files_trashbin/lib/Storage.php",
          "line": 193,
          "function": "call_user_func",
          "args": [
            [
              {
                "__class__": "OCA\\Files_Antivirus\\AvirWrapper",
                "cache": {
                  "__class__": "OC\\Files\\Cache\\Cache"
                },
                "scanner": null,
                "watcher": null,
                "propagator": null,
                "updater": null
              },
              "rmdir"
            ],
            "uploads/2666709409"
          ]
        },
        {
          "file": "/var/www/html/apps/files_trashbin/lib/Storage.php",
          "line": 125,
          "function": "doDelete",
          "class": "OCA\\Files_Trashbin\\Storage",
          "type": "->",
          "args": [
            "uploads/2666709409",
            "rmdir"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/View.php",
          "line": 1171,
          "function": "rmdir",
          "class": "OCA\\Files_Trashbin\\Storage",
          "type": "->",
          "args": [
            "uploads/2666709409"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Files/View.php",
          "line": 350,
          "function": "basicOperation",
          "class": "OC\\Files\\View",
          "type": "->",
          "args": [
            "rmdir",
            "/2666709409",
            [
              "delete"
            ]
          ]
        },
        {
          "file": "/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php",
          "line": 309,
          "function": "rmdir",
          "class": "OC\\Files\\View",
          "type": "->",
          "args": [
            "/2666709409"
          ]
        },
        {
          "file": "/var/www/html/apps/dav/lib/Upload/UploadFolder.php",
          "line": 80,
          "function": "delete",
          "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php",
          "line": 179,
          "function": "delete",
          "class": "OCA\\DAV\\Upload\\UploadFolder",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
          "line": 281,
          "function": "delete",
          "class": "Sabre\\DAV\\Tree",
          "type": "->",
          "args": [
            "uploads/user001/2666709409"
          ]
        },
        {
          "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
          "line": 89,
          "function": "httpDelete",
          "class": "Sabre\\DAV\\CorePlugin",
          "type": "->",
          "args": [
            {
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            }
          ]
        },
        {
          "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
          "line": 472,
          "function": "emit",
          "class": "Sabre\\DAV\\Server",
          "type": "->",
          "args": [
            "method:DELETE",
            [
              {
                "__class__": "Sabre\\HTTP\\Request"
              },
              {
                "__class__": "Sabre\\HTTP\\Response"
              }
            ]
          ]
        },
        {
          "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
          "line": 253,
          "function": "invokeMethod",
          "class": "Sabre\\DAV\\Server",
          "type": "->",
          "args": [
            {
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            }
          ]
        },
        {
          "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
          "line": 321,
          "function": "start",
          "class": "Sabre\\DAV\\Server",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/apps/dav/lib/Server.php",
          "line": 339,
          "function": "exec",
          "class": "Sabre\\DAV\\Server",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
          "line": 35,
          "function": "exec",
          "class": "OCA\\DAV\\Server",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/remote.php",
          "line": 166,
          "args": [
            "/var/www/html/apps/dav/appinfo/v2/remote.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/var/www/html/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php",
      "Line": 113
    },
    "CustomMessage": "Could not delete object urn:oid:641838 for uploads/2666709409/0000000000000000"
  },
  "id": "629ed8f71979a"
}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'XXXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'trusted_domains' => 
  array (
    0 => 'nc.url.fr',
    1 => 'onlyoffice-documentserver-data',
  ),
  'blacklisted_files' => 
  array (
    0 => '.htaccess',
    1 => 'Thumbs.db',
    2 => 'thumbs.db',
    3 => '@eaDir',
  ),
  'activity_expire_days' => 14,
  'dbtype' => 'mysql',
  'version' => '23.0.5.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'nc_mariadb',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'dbuser',
  'dbpassword' => 'dbpassword',
  'installed' => true,
  'onlyoffice' => 
  array (
    'DocumentServerUrl' => '/oo/',
    'DocumentServerInternalUrl' => 'http://DocumentServerInternalUrl/',
    'StorageUrl' => 'https://nc.url.fr/',
  ),
  'allow_local_remote_servers' => true,
  'maintenance' => false,
  'theme' => '',
  'updater.release.channel' => 'stable',
  'encryption.legacy_format_support' => false,
  'auth.bruteforce.protection.enabled' => true,
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'app_install_overwrite' => 
  array (
    0 => 'dicomviewer',
    1 => 'ocr',
    2 => 'radio',
    3 => 'camerarawpreviews',
    4 => 'joplin',
  ),
  'default_language' => 'fr',
  'default_phone_region' => 'FR',
  'default_locale' => 'fr_FR',
  'datadirectory' => '/data',
  'log_type' => 'file',
  'logfile' => 'nextcloud.log',
  'loglevel' => 2,
  'logdateformat' => 'Y-m-d H:i:s',
  'log_rotate_size' => 104857600,
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\PNG',
    ...
  ),
  'preview_max_x' => 1024,
  'preview_max_y' => 768,
  'preview_max_scale_factor' => 1,
  'trusted_proxies' => 
  array (
    0 => '192.168.1.1',
    1 => 'xxx:xxx:xxxx:xxxx:xxxx::1',
  ),
  'overwrite.cli.url' => 'https://nc.url.fr',
  'overwritehost' => 'nc.url.fr',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/',
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'nc_redis',
    'port' => '6379',
    'timeout' => 0.0,
  ),
  'trashbin_retention_obligation' => 'auto, 60',
  'versions_retention_obligation' => 'auto, 30',
  'remember_login_cookie_lifetime' => '18000',
  'objectstore' => 
  array (
    'class' => '\\OC\\Files\\ObjectStore\\S3',
    'arguments' => 
    array (
      'bucket' => 'nextcloud',
      'autocreate' => true,
      'key' => 'nextcloud',
      'secret' => 'secretkey',
      'hostname' => 's3.url.fr',
      'port' => 443,
      'use_ssl' => true,
      'region' => 'fr',
      'use_path_style' => true,
    ),
  ),
);

The output of your Apache/nginx/system log in /var/log/____:

docker logs nc | grep 2666709409
[Tue Jun 07 04:36:31.782264 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.53 (Debian) PHP/8.0.19 configured -- resuming normal operations
[Tue Jun 07 04:36:31.782302 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
2a01:cb00:54:7c00:85bc:5cb1:cdae:fc07 - user001 [07/Jun/2022:04:49:32 +0000] "MKCOL /remote.php/dav/uploads/user001/2666709409 HTTP/1.1" 201 548 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.22000 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
2a01:cb00:54:7c00:85bc:5cb1:cdae:fc07 - user001 [07/Jun/2022:04:49:32 +0000] "PUT /remote.php/dav/uploads/user001/2666709409/0000000000000000 HTTP/1.1" 201 730 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.22000 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
2a01:cb00:54:7c00:85bc:5cb1:cdae:fc07 - user001 [07/Jun/2022:04:49:33 +0000] "PUT /remote.php/dav/uploads/user001/2666709409/0000000000000001 HTTP/1.1" 201 730 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.22000 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
2a01:cb00:54:7c00:85bc:5cb1:cdae:fc07 - user001 [07/Jun/2022:04:49:37 +0000] "MOVE /remote.php/dav/uploads/user001/2666709409/.file HTTP/1.1" 403 944 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.22000 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
2a01:cb00:54:7c00:85bc:5cb1:cdae:fc07 - user001 [07/Jun/2022:04:49:58 +0000] "DELETE /remote.php/dav/uploads/user001/2666709409 HTTP/1.1" 403 740 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.22000 ClientArchitecture: x86_64 OsArchitecture: x86_64)"

S3 policy for nextcloud:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::nextcloud/*"
            ]
        }
    ]
}

S3 bucket configuration:

Retention

Retention Mode: Governance
Retention Unit: Days
Retention Validity*: 15

Summary

Object Locking: Enabled

Versioning

Current Status: Versioned

I’m not an expert on S3 storage but if I had to guess I would say the “Object Locking” prevents the deletion of the files. As far as I know this is meant for backups (cold storage) and not for data you work with on a daily basis (hot storage). Using S3 Object Lock - Amazon Simple Storage Service