Unable to use onedrive; get 400/404

What is the problem you are having with rclone?

I'm unable to use the remote. I have two OneDrive remotes set up (using an incognito window to prevent interference). In the configuration, the drive ID for one of them (onedrive-tomi) was in lowercase, causing rclone about onedrive-tomi: to fail.

After comparing it to another remote (onedrive-jane), where the drive ID was in all uppercase, I changed onedrive-tomi to match. Now, rclone about works and returns output. However, rclone lsd still does not work, returning a 404 error.

tomi@caladan:~$ rclone about onedrive-tomi:
Total:   1.005 TiB
Used:    1019.700 GiB
Free:    9.300 GiB
Trashed: 71.549 MiB

By dumping headers in verbose I can see that the onedrive API returns lower-case drive id which rclone tries to use going forward failing the command. I am not sure whether this is the issue, but it is suspicious. However, trying it myself in postman I get a 200 for exactly the same request which rclone runs using the lower-case id (copying the request from --dump-headers)

  • the below is rclone about onedrive-tomi: with the lower-case id failing with a 400
2025/03/24 23:25:17 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/24 23:25:17 DEBUG : HTTP REQUEST (req 0xc000342c80)
2025/03/24 23:25:17 DEBUG : GET /v1.0/drives/xxx/root HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.69.1
Authorization: XXXX
Accept-Encoding: gzip

2025/03/24 23:25:17 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/24 23:25:17 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2025/03/24 23:25:17 DEBUG : HTTP RESPONSE (req 0xc000342c80)
2025/03/24 23:25:17 DEBUG : HTTP/2.0 200 OK
Cache-Control: no-store, no-cache
Client-Request-Id: 993b0071-a2fb-4174-b6c6-857c16a7a1e4
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Mon, 24 Mar 2025 22:25:16 GMT
Odata-Version: 4.0
Request-Id: 993b0071-a2fb-4174-b6c6-857c16a7a1e4
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF000000E6"}}

2025/03/24 23:25:17 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2025/03/24 23:25:17 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/24 23:25:17 DEBUG : HTTP REQUEST (req 0xc000bef180)
2025/03/24 23:25:17 DEBUG : GET /v1.0/drives/xxx HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.69.1
Authorization: XXXX
Accept-Encoding: gzip

2025/03/24 23:25:17 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/24 23:25:17 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2025/03/24 23:25:17 DEBUG : HTTP RESPONSE (req 0xc000bef180)
2025/03/24 23:25:17 DEBUG : HTTP/2.0 400 Bad Request
Cache-Control: no-store, no-cache
Client-Request-Id: f4a65c7d-3f06-47c6-bf70-2f0a47640eb4
Content-Type: application/json
Date: Mon, 24 Mar 2025 22:25:16 GMT
Request-Id: f4a65c7d-3f06-47c6-bf70-2f0a47640eb4
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF000000E6"}}
  • the below is rclone about onedrive-tomi: with the upper-case id returning a 200
2025/03/24 23:27:42 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/24 23:27:42 DEBUG : HTTP REQUEST (req 0xc00044a780)
2025/03/24 23:27:42 DEBUG : GET /v1.0/drives/XXX/root HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.69.1
Authorization: XXXX
Accept-Encoding: gzip

2025/03/24 23:27:42 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/24 23:27:42 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2025/03/24 23:27:42 DEBUG : HTTP RESPONSE (req 0xc00044a780)
2025/03/24 23:27:42 DEBUG : HTTP/2.0 200 OK
Cache-Control: private
Client-Request-Id: 166977d7-9833-4068-831f-a7bdd7c22bc8
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Mon, 24 Mar 2025 22:27:41 GMT
Odata-Version: 4.0
Request-Id: 166977d7-9833-4068-831f-a7bdd7c22bc8
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF000000EA"}}

2025/03/24 23:27:42 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2025/03/24 23:27:42 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/24 23:27:42 DEBUG : HTTP REQUEST (req 0xc000c11680)
2025/03/24 23:27:42 DEBUG : GET /v1.0/drives/XXX HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.69.1
Authorization: XXXX
Accept-Encoding: gzip

2025/03/24 23:27:42 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/24 23:27:43 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2025/03/24 23:27:43 DEBUG : HTTP RESPONSE (req 0xc000c11680)
2025/03/24 23:27:43 DEBUG : HTTP/2.0 200 OK
Cache-Control: no-store
Client-Request-Id: 8038c316-b8f2-417b-b57f-490643c523d3
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Mon, 24 Mar 2025 22:27:41 GMT
Odata-Version: 4.0
Request-Id: 8038c316-b8f2-417b-b57f-490643c523d3
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF000000EA"}}

2025/03/24 23:27:43 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Total:   1.005 TiB
Used:    1019.700 GiB
Free:    9.300 GiB
Trashed: 71.549 MiB
2025/03/24 23:27:43 DEBUG : 5 go routines active

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

rclone v1.69.1
- os/version: debian 12.10 (64 bit)
- os/kernel: 5.15.167.4-microsoft-standard-WSL2 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.24.0
- go/linking: static
- go/tags: none

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

Microsoft OneDrive

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

rclone lsd onedrive-tomi:

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

tomi@caladan:~$ rclone config redacted
[onedrive-jane]
type = onedrive
token = XXX
drive_id = XXX
drive_type = personal

[onedrive-tomi]
type = onedrive
token = XXX
drive_id = XXX
drive_type = personal

A log from the command that you were trying to run with the -vv flag

tomi@caladan:~$ rclone lsd onedrive-tomi: -vv
2025/03/24 23:06:14 DEBUG : rclone: Version "v1.69.1" starting with parameters ["rclone" "lsd" "onedrive-tomi:" "-vv"]
2025/03/24 23:06:14 DEBUG : Creating backend with remote "onedrive-tomi:"
2025/03/24 23:06:14 DEBUG : Using config file from "/home/tomi/.config/rclone/rclone.conf"
2025/03/24 23:06:15 ERROR : : error listing: couldn't list files: itemNotFound: The resource could not be found.
2025/03/24 23:06:15 DEBUG : 5 go routines active
2025/03/24 23:06:15 NOTICE: Failed to lsd with 2 errors: last error was: couldn't list files: itemNotFound: The resource could not be found.

Interestingly if I specify onedrive-root-folder-id I can run rclone lsd onedrive-tomi: --onedrive-root-folder-id root and it lists everything successfully. The same goes for any other folder... obviously it doesn't work with copying and drilling down into folders, but interesting nevertheless.

Also interestingly the onedrive which doesn't work shows the following list drives:

Select drive you want to use
Choose a number from below, or type in your own value of type string.
Press Enter for the default (aaa).
 1 /  (personal)
   \ (aaa)
config_driveid>

while the one which works shows:

Select drive you want to use
Choose a number from below, or type in your own value of type string.
Press Enter for the default (aaa).
 1 / AEEE102E-CFF8-4E2A-89C6-03841FF83500 (personal)
   \ (aaa)
 2 / Bundles_b896e2bb7ca3447691823a44c4ad6ad7 (personal)
   \ (bbb)
 3 / ODCMetadataArchive (personal)
   \ (ccc)
 4 / OneDrive (personal)
   \ (bbb)

No ide about the difference, both are personal onedrives.

okay, I give up. Just setup rclone for my dad who also has a lower-case onedrive-id and things work just fine for him... what is wrong with my account??

update
I think I figured out at least what triggers it. I tried just this morning and things worked?! Then I tried to copy over items from one onedrive to another onedrive using --onedrive-server-side-across-configs which failed with some permission denied error. However retrying the command, now without server side config got me back to the original error where source directory can not be found.

So it seems setting --onedrive-server-side-across-configs messes up rclone putting it in some state which breaks it somehow persisting?? for a few days. It still doesn't make sense though as rclone is supposedly stateless and also using the microsoft graph API directly for the same commands does not produce an error?

update
I am still unsure of the problem but deleting the configuration and recreating it after the normal token expiry (e.g. 24h later) and everything works with the normal lower-case drive id. However if I initiate a '--onedrive-server-side-across-configs' copy I'm back where I started and everything fails.

So it seems the issue is with '--onedrive-server-side-across-configs' which somehow messes up the onedrive remote resulting in non-operability. I do have to reiterate that - assuming rclone has no state - using the (wrong?) token in the config and recreating the same RESTful call through postman/curl or any other tool does return a success response; it's only rclone which is failing.

For comparison this is the verbose output of rclone lsd onedrive-tomi: when it does work after waiting and recreating the config as above (I have replaced the drive-id with 'xxx' when it's shown lower-case in the logs and with 'XXX' when it's upper-case in the logs):

tomi@caladan:~$ rclone lsd onedrive-tomi: --dump-headers
2025/03/27 07:24:48 NOTICE: --dump-headers is obsolete - please use --dump headers instead
2025/03/27 07:24:48 NOTICE: Automatically setting -vv as --dump is enabled
2025/03/27 07:24:48 DEBUG : rclone: Version "v1.69.1" starting with parameters ["rclone" "lsd" "onedrive-tomi:" "--dump-headers"]
2025/03/27 07:24:48 DEBUG : Creating backend with remote "onedrive-tomi:"
2025/03/27 07:24:48 DEBUG : Using config file from "/home/tomi/.config/rclone/rclone.conf"
2025/03/27 07:24:48 DEBUG : You have specified to dump information. Please be noted that the Accept-Encoding as shown may not be correct in the request and the response may not show Content-Encoding if the go standard libraries auto gzip encoding was in effect. In this case the body of the request will be gunzipped before showing it.
2025/03/27 07:24:48 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/27 07:24:48 DEBUG : HTTP REQUEST (req 0xc00068e3c0)
2025/03/27 07:24:48 DEBUG : GET /v1.0/drives/xxx/root HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.69.1
Authorization: XXXX
Accept-Encoding: gzip

2025/03/27 07:24:48 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/27 07:24:48 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2025/03/27 07:24:48 DEBUG : HTTP RESPONSE (req 0xc00068e3c0)
2025/03/27 07:24:48 DEBUG : HTTP/2.0 200 OK
Cache-Control: private
Client-Request-Id: c03c77cc-a6e0-4f5f-bfd9-a1550d631685
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Thu, 27 Mar 2025 06:24:48 GMT
Odata-Version: 4.0
Request-Id: c03c77cc-a6e0-4f5f-bfd9-a1550d631685
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PEPF000000C2"}}

2025/03/27 07:24:48 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2025/03/27 07:24:48 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/27 07:24:48 DEBUG : HTTP REQUEST (req 0xc000b75900)
2025/03/27 07:24:48 DEBUG : GET /v1.0/drives/xxx/items/XXX!154/children?$top=1000 HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.69.1
Authorization: XXXX
Accept-Encoding: gzip

2025/03/27 07:24:48 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2025/03/27 07:24:49 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2025/03/27 07:24:49 DEBUG : HTTP RESPONSE (req 0xc000b75900)
2025/03/27 07:24:49 DEBUG : HTTP/2.0 200 OK
Cache-Control: no-store
Client-Request-Id: a4cc620f-ad7b-4b03-9bd7-c4d7e3094da6
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Thu, 27 Mar 2025 06:24:48 GMT
Odata-Version: 4.0
Request-Id: a4cc620f-ad7b-4b03-9bd7-c4d7e3094da6
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PEPF000000C2"}}

update and conclusion

I can confirm that something gets confused? after using --server-side-across-config and irrevocably corrupts the authentication token for the specific Microsoft data centre until the expiry date. Recreating the config (and thus asking for a new token) does not resolve the issue.

Calling https://graph.microsoft.com/v1.0/drives/xxx/root prior and after shows the response differences:

rclone lsd before using --server-side-across-config

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('<drive-id-lowercase>')/root/$entity",
  "createdDateTime": "2009-08-27T21:17:18.623Z",
  "cTag": "<c-tag-1>",
  "eTag": "<e-tag-1>",
  "id": "<drive-id-uppercase>!154",
  "lastModifiedDateTime": "2025-03-26T21:41:34.297Z",
  "name": "root",
  "size": 1034972219386,
  "webUrl": "https://onedrive.live.com/?cid=<drive-id-lowercase>",
  "createdBy": {
    "user": {
      "displayName": "<my-name>",
      "id": "<drive-id-lowercase>"
    }
  },
  "lastModifiedBy": {
    "user": {
      "displayName": "<my-name>",
      "id": "<drive-id-lowercase>"
    }
  },
  "parentReference": {
    "driveId": "<drive-id-lowercase>",
    "driveType": "personal"
  },
  "fileSystemInfo": {
    "createdDateTime": "2009-08-27T21:17:18.623Z",
    "lastModifiedDateTime": "2023-05-20T13:45:58.676Z"
  },
  "folder": {
    "childCount": 12,
    "view": {
      "viewType": "thumbnails",
      "sortBy": "name",
      "sortOrder": "ascending"
    }
  },
  "root": {}
}

rclone lsd after --server-side-across-config

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('<drive-id-lowercase>')/root/$entity",
  "createdDateTime": "2025-02-26T05:30:04Z",
  "eTag": "\"{<e-tag-2>},256\"",
  "id": "<drive-id-uppercase>!sea8cc6beffdb43d7976fbc7da445c639",
  "lastModifiedDateTime": "2025-03-25T20:51:12Z",
  "name": "root",
  "webUrl": "https://onedrive.live.com?cid=<drive-id-uppercase>&id=01E5XVDI56Y2GOVW7725BZO354PWSELRRZ",
  "size": 0,
  "createdBy": {
    "user": {
      "email": "<email>",
      "displayName": "<my-name>"
    }
  },
  "parentReference": {
    "driveType": "personal",
    "driveId": "<some-drive-id?>"
  },
  "fileSystemInfo": {
    "createdDateTime": "2025-02-26T05:30:04Z",
    "lastModifiedDateTime": "2025-03-25T20:51:12Z"
  },
  "folder": {
    "childCount": 0,
    "view": {
      "sortBy": "name",
      "sortOrder": "ascending",
      "viewType": "thumbnails"
    }
  },
  "root": {}
}

I would put this down to a Microsoft OneDrive bug caused by rclone's --server-side-across-config corrupting the token for that specific data centre. Using curl with the same parameters also fails, however using an online tool like https://reqbin.com works as that one connects to the "East US 2" datacentre while locally I'm connecting to "Switzerland North"