Rclone cleanup failed to check/remove SharePoint file history version

What is the problem you are having with rclone?

Rclone cleanup failed to check/remove SharePoint file history version

Run the command 'rclone version' and share the full output of the command.

rclone v1.58.1

  • os/version: ubuntu 18.04 (64 bit)
  • os/kernel: 4.4.0-17763-Microsoft (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.17.9
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

SharePoint operated by 21Vianet in China

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone -vv cleanup 202201-02:/202201/Even

The rclone config contents with secrets removed.

type = onedrive
client_id = xxx
client_secret = xxx
region = cn
token = {"access_token":"xxx","token_type":"Bearer","refresh_token":"xxx","expiry":"2022-06-15T16:53:36.9455001+08:00"}
drive_id = xxx
drive_type = documentLibrary

A log from the command with the -vv flag

I tried -vv and -vvv, it seems rclone did not print the response json

2022/06/15 16:46:50 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "-vv" "cleanup" "202201-02:/202201/Even"]
2022/06/15 16:46:50 DEBUG : Creating backend with remote "202201-02:/202201/Even"
2022/06/15 16:46:50 DEBUG : Using config file from "/home/tyh/.config/rclone/rclone.conf"
2022/06/15 16:46:51 DEBUG : fs cache: renaming cache item "202201-02:/202201/Even" to be canonical "202201-02:202201/Even"
2022/06/15 16:46:52 ERROR : aaa.mp4: Failed to remove versions: invalid character '{' looking for beginning of object key string
2022/06/15 16:46:52 ERROR : bbb.mp4: Failed to remove versions: invalid character '{' looking for beginning of object key string
2022/06/15 16:46:52 ERROR : ccc.mp4: Failed to remove versions: invalid character '{' looking for beginning of object key string
........
2022/06/15 16:46:54 DEBUG : 3 go routines active

Can you run this with -vv dump bodies and capture one of the failing requests and responses? It looks like it is returning something unexpected.

Here is part of dump file

2022/06/15 22:11:39 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : HTTP REQUEST (req 0xc0007eef00)
2022/06/15 22:11:39 DEBUG : GET /v1.0/drives/b!YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR/items/012HZBY2BJCYZNQZRVXVDL4YDJN36FORFQ/versions HTTP/1.1
Host: microsoftgraph.chinacloudapi.cn
User-Agent: rclone/v1.58.1
Authorization: XXXX
Accept-Encoding: gzip

2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : HTTP REQUEST (req 0xc00014a600)
2022/06/15 22:11:39 DEBUG : GET /v1.0/drives/b!YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR/items/012HZBY2FSFHIH6JJR5NFZKXDZAMYJT5JM/versions HTTP/1.1
Host: microsoftgraph.chinacloudapi.cn
User-Agent: rclone/v1.58.1
Authorization: XXXX
Accept-Encoding: gzip

2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : HTTP REQUEST (req 0xc00014b900)
2022/06/15 22:11:39 DEBUG : GET /v1.0/drives/b!YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR/items/012HZBY2CHLF3QT7YCTFFK3ZLMW3GPEYPW/versions HTTP/1.1
Host: microsoftgraph.chinacloudapi.cn
User-Agent: rclone/v1.58.1
Authorization: XXXX
Accept-Encoding: gzip

2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : HTTP REQUEST (req 0xc00014bd00)
2022/06/15 22:11:39 DEBUG : GET /v1.0/drives/b!YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR/items/012HZBY2CY5CRWAUV6T5B3FHS737VDEPGR/versions HTTP/1.1
Host: microsoftgraph.chinacloudapi.cn
User-Agent: rclone/v1.58.1
Authorization: XXXX
Accept-Encoding: gzip

2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : HTTP REQUEST (req 0xc000d6a100)
2022/06/15 22:11:39 DEBUG : GET /v1.0/drives/b!YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR/items/012HZBY2ATWR6BRXTUFVC22LECZ74WJAMI/versions HTTP/1.1
Host: microsoftgraph.chinacloudapi.cn
User-Agent: rclone/v1.58.1
Authorization: XXXX
Accept-Encoding: gzip

2022/06/15 22:11:39 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/06/15 22:11:39 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:39 DEBUG : HTTP RESPONSE (req 0xc0007eef00)
2022/06/15 22:11:39 DEBUG : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-store, no-cache
Client-Request-Id: 3a8d99e6-337f-4885-a445-23e1649fb120
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Wed, 15 Jun 2022 14:11:40 GMT
Odata-Version: 4.0
Request-Id: 3a8d99e6-337f-4885-a445-23e1649fb120
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"China East","Slice":"E","Ring":"6","ScaleUnit":"001","RoleInstance":"SH1NEPF00000389"}}

1ea
{{"error":{"code":"InternalServerError","message":"The Path property 'drives('b%21YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR')/items('012HZBY2BJCYZNQZRVXVDL4YDJN36FORFQ')/versions' of ODataMessageWriterSetting.ODataUri must end with the navigation property which the contained elements being written belong to.","innerError":{"date":"2022-06-15T14:11:40","request-id":"3a8d99e6-337f-4885-a445-23e1649fb120","client-request-id":"3a8d99e6-337f-4885-a445-23e1649fb120"}}}
0

2022/06/15 22:11:39 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:39 ERROR : 220107-172733 来看新模~!!.mp4: Failed to remove versions: invalid character '{' looking for beginning of object key string
2022/06/15 22:11:39 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:39 DEBUG : HTTP RESPONSE (req 0xc00014bd00)
2022/06/15 22:11:39 DEBUG : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-store, no-cache
Client-Request-Id: 15c4279a-db5a-4812-a28d-594dff6d4910
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Wed, 15 Jun 2022 14:11:40 GMT
Odata-Version: 4.0
Request-Id: 15c4279a-db5a-4812-a28d-594dff6d4910
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"China North","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"BJ1NEPF00000679"}}

1ea
{{"error":{"code":"InternalServerError","message":"The Path property 'drives('b%21YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR')/items('012HZBY2CY5CRWAUV6T5B3FHS737VDEPGR')/versions' of ODataMessageWriterSetting.ODataUri must end with the navigation property which the contained elements being written belong to.","innerError":{"date":"2022-06-15T14:11:40","request-id":"15c4279a-db5a-4812-a28d-594dff6d4910","client-request-id":"15c4279a-db5a-4812-a28d-594dff6d4910"}}}
0

2022/06/15 22:11:39 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:39 ERROR : 220111-175216 来看新模~!!.mp4: Failed to remove versions: invalid character '{' looking for beginning of object key string
2022/06/15 22:11:40 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:40 DEBUG : HTTP RESPONSE (req 0xc00014a600)
2022/06/15 22:11:40 DEBUG : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-store, no-cache
Client-Request-Id: 01d90738-4d7e-4298-8b01-d36df288ece6
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Wed, 15 Jun 2022 14:11:40 GMT
Odata-Version: 4.0
Request-Id: 01d90738-4d7e-4298-8b01-d36df288ece6
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"China East","Slice":"E","Ring":"6","ScaleUnit":"001","RoleInstance":"SH1NEPF0000034A"}}

1ea
{{"error":{"code":"InternalServerError","message":"The Path property 'drives('b%21YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR')/items('012HZBY2FSFHIH6JJR5NFZKXDZAMYJT5JM')/versions' of ODataMessageWriterSetting.ODataUri must end with the navigation property which the contained elements being written belong to.","innerError":{"date":"2022-06-15T14:11:40","request-id":"01d90738-4d7e-4298-8b01-d36df288ece6","client-request-id":"01d90738-4d7e-4298-8b01-d36df288ece6"}}}
0

2022/06/15 22:11:40 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:40 ERROR : 220114-202842 大家过年好【?.mp4: Failed to remove versions: invalid character '{' looking for beginning of object key string
2022/06/15 22:11:40 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:40 DEBUG : HTTP RESPONSE (req 0xc00014b900)
2022/06/15 22:11:40 DEBUG : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-store, no-cache
Client-Request-Id: e6aa3332-f216-4524-950d-710072f5691e
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Wed, 15 Jun 2022 14:11:40 GMT
Odata-Version: 4.0
Request-Id: e6aa3332-f216-4524-950d-710072f5691e
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"China North","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"BJ1NEPF00000677"}}

1ea
{{"error":{"code":"InternalServerError","message":"The Path property 'drives('b%21YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR')/items('012HZBY2CHLF3QT7YCTFFK3ZLMW3GPEYPW')/versions' of ODataMessageWriterSetting.ODataUri must end with the navigation property which the contained elements being written belong to.","innerError":{"date":"2022-06-15T14:11:40","request-id":"e6aa3332-f216-4524-950d-710072f5691e","client-request-id":"e6aa3332-f216-4524-950d-710072f5691e"}}}
0

2022/06/15 22:11:40 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:40 ERROR : 220110-211440 来看新模~!!.mp4: Failed to remove versions: invalid character '{' looking for beginning of object key string
2022/06/15 22:11:40 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:40 DEBUG : HTTP RESPONSE (req 0xc000d6a100)
2022/06/15 22:11:40 DEBUG : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-store, no-cache
Client-Request-Id: 8a058563-f608-499c-9b70-68b206c61eff
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Wed, 15 Jun 2022 14:11:40 GMT
Odata-Version: 4.0
Request-Id: 8a058563-f608-499c-9b70-68b206c61eff
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"China East","Slice":"E","Ring":"6","ScaleUnit":"001","RoleInstance":"SH1NEPF0000034B"}}

1ea
{{"error":{"code":"InternalServerError","message":"The Path property 'drives('b%21YjG7hd6R8Uq4F_QbA1D1nkjCjIzAGOFMl-hu_zNvN2fKqvXBc-DMTohe3CP-84gR')/items('012HZBY2ATWR6BRXTUFVC22LECZ74WJAMI')/versions' of ODataMessageWriterSetting.ODataUri must end with the navigation property which the contained elements being written belong to.","innerError":{"date":"2022-06-15T14:11:41","request-id":"8a058563-f608-499c-9b70-68b206c61eff","client-request-id":"8a058563-f608-499c-9b70-68b206c61eff"}}}
0

2022/06/15 22:11:40 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/06/15 22:11:40 ERROR : 220112-190548 来看新模~!!.mp4: Failed to remove versions: invalid character '{' looking for beginning of object key string
2022/06/15 22:11:40 DEBUG : 13 go routines active

That looks like a very specific error. No idea what it means though! Do you?

The fact that the response is a 200 leads rclone to believe it is a real response and not an error, so it mis parses it.

I have no ideas too. I have tested similar HTTP GET in Microsoft Graph Explorer, it's OK and able to get results. But I can't find the way to sign in the 21Varient account. (Usually MS account can sign in on login.microsoftonline.com, but the specific account need to sign in at login.partner.microsoftonline.cn) Also, when I searched about "The Path property of ODataMessageWriterSetting.ODataUri must end with the navigation property" I got some results, but noting related to versions.

What we need is a onedrive expert. Luckily we have some that drop by from time to time so can you open a new issue on Github about this and I'll tag some friendly experts and see if we can get help.