Getting "googleapi: Error 404: File not found:" error only for some files in a remote

What is the problem you are having with rclone?

Downloading from GDrive with rclone copy or rclone sync results in a googleapi: Error 404: File not found: error for some files in a remote, other files are copied fine.

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

~# rclone --version
rclone v1.58.1
- os/version: debian 10.4 (64 bit)
- os/kernel: 4.19.0-9-amd64 (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)

Google Drive

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

rclone copy pro:"/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf" .

The rclone config contents with secrets removed.

[pro]
type = drive
scope = drive
token = {"access_token":"ya****","token_type":"Bearer","refresh_token":"1//0****","expiry":"2022-05-12T11:40:04.844864123+02:00"}
client_id = 89****.apps.googleusercontent.com
client_secret = ****
root_folder_id = 1cv****
team_drive =

A log from the command with the -vv flag

~# rclone copy pro:"/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf" . -vv
2022/05/12 11:13:21 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "copy" "pro:/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf" "." "-vv"]
2022/05/12 11:13:21 DEBUG : Creating backend with remote "pro:/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf"
2022/05/12 11:13:21 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2022/05/12 11:13:31 DEBUG : fs cache: adding new entry for parent of "pro:/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf", "pro:COMUNICACIOĢ/10. Premsa"
2022/05/12 11:13:31 DEBUG : Creating backend with remote "."
2022/05/12 11:13:31 DEBUG : fs cache: renaming cache item "." to be canonical "/var/****/workdir"
2022/05/12 11:13:32 DEBUG : PORTADAS.pdf: Need to transfer - File not found at Destination
2022/05/12 11:13:32 ERROR : PORTADAS.pdf: Failed to copy: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 11:13:32 ERROR : Attempt 1/3 failed with 1 errors and: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 11:13:32 DEBUG : PORTADAS.pdf: Need to transfer - File not found at Destination
2022/05/12 11:13:33 ERROR : PORTADAS.pdf: Failed to copy: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 11:13:33 ERROR : Attempt 2/3 failed with 1 errors and: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 11:13:33 DEBUG : PORTADAS.pdf: Need to transfer - File not found at Destination
2022/05/12 11:13:33 ERROR : PORTADAS.pdf: Failed to copy: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 11:13:33 ERROR : Attempt 3/3 failed with 1 errors and: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 11:13:33 INFO  : 
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:        12.5s

2022/05/12 11:13:33 DEBUG : 5 go routines active
2022/05/12 11:13:33 Failed to copy: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound

I have seen that these 404 googleapi errors are often caused by lack of permissions, but this doesn't seem to be the case, since I can get the file details from the remote:

~# rclone lsl pro:"/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf"
   159789 2016-10-14 08:47:44.952000000 PORTADAS.pdf

There are 21311 objects in the "pro:"/COMUNICACIOĢ/" path. Most of them are copied correctly, but 92 of them throw this same 404 error. The failing files do exist in the remote, I can open them from the GDrive web UI using the same account that is authorized in the "pro:" remote.

I haven't been able to find a common pattern for the failing objects. Some of them are folders, most of them are files.

Any pointers will be appreciated!

This must be the 3rd message on the forum today complaining about "Error 404" - I wonder if google has changed something.

Do they have different owners or something like that?

This seems like it is a Google problem rather than an rclone problem but it is difficult to say for certain.

Can you do this test

rclone copy pro:"/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf" . -vv --dump bodies --low-level-retries 1 --retries 1

And post the output? Or if you think it might contain info you don't want public you can private message me with the log.

Thanks

It could be indeed something that changed on G's side, I haven't had this issue before.

The files on this remote are owned by a number of users but I couldn't find a correlation: failing files belong to several users (at least 3) but other files from those users are correctly tranferred.

I have PM'd you the output of the above command. If we later think it can be useful for others I'll be happy to redact it as needed and paste it here as well.

Thanks for your help!

hi,
as a test, remove root_folder_id = 1cv****

I got the same 404 error (had to add the "/bc/" root folder to the file path since I removed it from the remote configuration):

~# rclone copy pro:"/bc/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf" . -vv
2022/05/12 15:31:29 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "copy" "pro:/bc/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf" "." "-vv"]
2022/05/12 15:31:29 DEBUG : Creating backend with remote "pro:/bc/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf"
2022/05/12 15:31:29 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2022/05/12 15:31:29 DEBUG : Google drive root 'bc/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf': 'root_folder_id = 0AKhY_TY2DIVJUk9PVA' - save this in the config to speed up startup
2022/05/12 15:31:32 DEBUG : fs cache: adding new entry for parent of "pro:/bc/COMUNICACIOĢ/10. Premsa/PORTADAS.pdf", "pro:bc/COMUNICACIOĢ/10. Premsa"
2022/05/12 15:31:32 DEBUG : Creating backend with remote "."
2022/05/12 15:31:32 DEBUG : fs cache: renaming cache item "." to be canonical "/var/****/workdir"
2022/05/12 15:31:32 DEBUG : PORTADAS.pdf: Need to transfer - File not found at Destination
2022/05/12 15:31:32 ERROR : PORTADAS.pdf: Failed to copy: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 15:31:32 ERROR : Attempt 1/3 failed with 1 errors and: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 15:31:33 DEBUG : PORTADAS.pdf: Need to transfer - File not found at Destination
2022/05/12 15:31:33 ERROR : PORTADAS.pdf: Failed to copy: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 15:31:33 ERROR : Attempt 2/3 failed with 1 errors and: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 15:31:33 DEBUG : PORTADAS.pdf: Need to transfer - File not found at Destination
2022/05/12 15:31:34 ERROR : PORTADAS.pdf: Failed to copy: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 15:31:34 ERROR : Attempt 3/3 failed with 1 errors and: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound
2022/05/12 15:31:34 INFO  : 
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         5.0s

2022/05/12 15:31:34 DEBUG : 5 go routines active
2022/05/12 15:31:34 Failed to copy: failed to open source object: open file failed: googleapi: Error 404: File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz., notFound

Thank you for that.

I'll post the most important parts redacted here.

Firstly, yes google really does return a 404 message

2022/05/12 14:09:28 DEBUG : GET /drive/v3/files/0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz?alt=media HTTP/1.1
Host: www.googleapis.com
User-Agent: rclone/v1.58.1
Authorization: XXXX
Accept-Encoding: gzip
2022/05/12 14:09:28 DEBUG : HTTP RESPONSE (req 0xc000784c00)
2022/05/12 14:09:28 DEBUG : HTTP/1.1 404 Not Found
Content-Length: 338
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private, max-age=0
Content-Type: application/json; charset=UTF-8
Date: Thu, 12 May 2022 12:09:28 GMT
Expires: Thu, 12 May 2022 12:09:28 GMT
Server: UploadServer
Vary: Origin
Vary: X-Origin
X-Guploader-Uploadid: ADPycduOOR8JUz_ihnqNdOTt4zyh9E0KZSrDruWrhi4_8xIeSQ0xebU3dgBIxlZIv6E7sO-MoNIhI0YLtM0705buo3RSBg

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz.",
    "locationType": "parameter",
    "location": "fileId"
   }
  ],
  "code": 404,
  "message": "File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz."
 }
}

There is a bit more detail in the error message, but nothing really interesting.

Let's look at the file in the listing

    {
      "id": "0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz",
      "name": "PORTADAS.pdf",
      "mimeType": "application/pdf",
      "trashed": false,
      "explicitlyTrashed": false,
      "parents": [
        "..."
      ],
      "webViewLink": "...",
      "createdTime": "2016-10-13T22:22:56.000Z",
      "modifiedTime": "2016-10-14T06:47:44.952Z",
      "md5Checksum": "0665a097cd9a5a203f62f9cadc5d5304",
      "size": "159789"
    }

There is absolutely nothing unusual I can see about that.

What might be useful is to see the complete info about the file - rclone only asks for a small portiion of the info.

You can try this here in the Google API explorer: Files: get Ā |Ā  Drive API Ā |Ā  Google Developers

You'll need to auth with the same user that you are trying to use with rclone, then put the id of the file in the fileID field and send the request. You could see a similar JSON blob but with more info. What each field means is explained in the API docs but I'm particularly interested in the capabilities section which shows what the user you are using can do to the file. The other things in there may give you a clue also, but are likely to contain sensitive details about users / usernames so you may want to edit them first if you post them here.

1 Like

Hmm this is weird. The get API request returns a 404 as well. I'm adding fields=* to request all metadata and not the default field set:

curl \
  'https://www.googleapis.com/drive/v3/files/0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz?fields=*&key=[YOUR_API_KEY]' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \
  --compressed
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz.",
    "locationType": "parameter",
    "location": "fileId"
   }
  ],
  "code": 404,
  "message": "File not found: 0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz."
 }
}

As mentioned in the original post, I can open the file from the web UI. I can also open it with a public link using the fileID

This is the output of the same request for another file in the same share and folder, owned by the same user (redacted), which was successfully transferred:

{
 "kind": "drive#file",
 "id": "[REDACTED]",
 "name": "[REDACTED]",
 "mimeType": "application/vnd.google-apps.document",
 "starred": false,
 "trashed": false,
 "explicitlyTrashed": false,
 "parents": [
  "[REDACTED]"
 ],
 "spaces": [
  "drive"
 ],
 "version": "153",
 "webViewLink": "[REDACTED]",
 "iconLink": "[REDACTED]",
 "hasThumbnail": true,
 "thumbnailLink": "[REDACTED]",
 "thumbnailVersion": "31",
 "viewedByMe": false,
 "createdTime": "2017-12-18T13:19:33.218Z",
 "modifiedTime": "2017-12-18T16:16:33.428Z",
 "modifiedByMe": false,
 "owners": [
  {
   "kind": "drive#user",
   "displayName": "[REDACTED]",
   "photoLink": "[REDACTED]",
   "me": false,
   "permissionId": "[REDACTED]",
   "emailAddress": "[REDACTED]"
  }
 ],
 "shared": true,
 "ownedByMe": false,
 "capabilities": {
  "canAcceptOwnership": false,
  "canAddChildren": false,
  "canAddMyDriveParent": false,
  "canChangeCopyRequiresWriterPermission": false,
  "canChangeSecurityUpdateEnabled": false,
  "canChangeViewersCanCopyContent": false,
  "canComment": false,
  "canCopy": true,
  "canDelete": false,
  "canDownload": true,
  "canEdit": false,
  "canListChildren": false,
  "canModifyContent": false,
  "canMoveChildrenWithinDrive": false,
  "canMoveItemIntoTeamDrive": false,
  "canMoveItemOutOfDrive": false,
  "canMoveItemWithinDrive": false,
  "canReadRevisions": false,
  "canRemoveChildren": false,
  "canRemoveMyDriveParent": true,
  "canRename": false,
  "canShare": false,
  "canTrash": false,
  "canUntrash": false
 },
 "viewersCanCopyContent": true,
 "copyRequiresWriterPermission": false,
 "writersCanShare": true,
 "quotaBytesUsed": "0",
 "isAppAuthorized": false,
 "exportLinks": {
  "application/rtf": "[REDACTED]",
  "application/vnd.oasis.opendocument.text": "[REDACTED]",
  "text/html": "[REDACTED]",
  "application/pdf": "[REDACTED]",
  "application/epub+zip": "[REDACTED]",
  "application/zip": "[REDACTED]",
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "[REDACTED]",
  "text/plain": "[REDACTED]"
 },
 "linkShareMetadata": {
  "securityUpdateEligible": false,
  "securityUpdateEnabled": true
 }
}

ok looks like the request does succeed sometimes. Just sent the exact same curl with the same auth and got a 200 response for the same fileID that failed 5 minutes ago:

curl \
  'https://www.googleapis.com/drive/v3/files/0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz?fields=*&key=[YOUR_API_KEY]' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \
  --compressed
{
 "kind": "drive#file",
 "id": "0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz",
 "name": "PORTADAS.pdf",
 "mimeType": "application/pdf",
 "starred": false,
 "trashed": false,
 "explicitlyTrashed": false,
 "parents": [
  "[REDACTED]"
 ],
 "spaces": [
  "drive"
 ],
 "version": "116932",
 "webContentLink": "https://drive.google.com/uc?id=0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz&export=download&resourcekey=0-EMPF4EwfqM2u2BtrVuQeAQ",
 "webViewLink": "https://drive.google.com/file/d/0B15NJBKtA97odkgyZTVIMjhvMnZMWEFrRk9KdTlLNnhpT0Vz/view?usp=drivesdk&resourcekey=0-EMPF4EwfqM2u2BtrVuQeAQ",
 "iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/application/pdf",
 "hasThumbnail": true,
 "thumbnailLink": "https://lh4.googleusercontent.com/XjsNkHnIEHml_5V718wyxGEP1ERs-ZaQP2gNDxHWGzn7BMAlZ2q9N3bkgEgwuL04qGdynei0s_pjGtXLMbLSJjf58tTbdx6UHnXjBjAKyRyliayp-URynpQ1BwWew6GLqQ=s220",
 "thumbnailVersion": "2",
 "viewedByMe": true,
 "viewedByMeTime": "2022-05-13T09:37:57.092Z",
 "createdTime": "2016-10-13T22:22:56.000Z",
 "modifiedTime": "2016-10-14T06:47:44.952Z",
 "modifiedByMe": false,
 "sharedWithMeTime": "2022-05-13T09:37:57.092Z",
 "owners": [
  {
   "kind": "drive#user",
   "displayName": "[REDACTED]",
   "photoLink": "[REDACTED]",
   "me": false,
   "permissionId": "[REDACTED]",
   "emailAddress": "[REDACTED]"
  }
 ],
 "lastModifyingUser": {
  "kind": "drive#user",
  "displayName": "[REDACTED]",
  "photoLink": "[REDACTED]",
  "me": false,
  "permissionId": "[REDACTED]",
  "emailAddress": "[REDACTED]"
 },
 "shared": true,
 "ownedByMe": false,
 "capabilities": {
  "canAcceptOwnership": false,
  "canAddChildren": false,
  "canAddMyDriveParent": false,
  "canChangeCopyRequiresWriterPermission": false,
  "canChangeSecurityUpdateEnabled": false,
  "canChangeViewersCanCopyContent": false,
  "canComment": false,
  "canCopy": true,
  "canDelete": false,
  "canDownload": true,
  "canEdit": false,
  "canListChildren": false,
  "canModifyContent": false,
  "canMoveChildrenWithinDrive": false,
  "canMoveItemIntoTeamDrive": false,
  "canMoveItemOutOfDrive": false,
  "canMoveItemWithinDrive": false,
  "canReadRevisions": false,
  "canRemoveChildren": false,
  "canRemoveMyDriveParent": true,
  "canRename": false,
  "canShare": false,
  "canTrash": false,
  "canUntrash": false
 },
 "viewersCanCopyContent": true,
 "copyRequiresWriterPermission": false,
 "writersCanShare": true,
 "originalFilename": "PORTADAS.pdf",
 "fullFileExtension": "pdf",
 "fileExtension": "pdf",
 "md5Checksum": "0665a097cd9a5a203f62f9cadc5d5304",
 "size": "159789",
 "quotaBytesUsed": "159789",
 "headRevisionId": "0B15NJBKtA97oQkRqb252bjVuV1QwRng4a2FpWTNaTzF0ZFdjPQ",
 "isAppAuthorized": false,
 "resourceKey": "0-EMPF4EwfqM2u2BtrVuQeAQ",
 "linkShareMetadata": {
  "securityUpdateEligible": true,
  "securityUpdateEnabled": true
 }
}

I'm re-running the whole sync which had 92 files returning 404 errors, let's see how that goes.

That is definitely sounding like a Google problem then.

That is good.

I'll be interested to find out :slight_smile:

1 Like

I got the 404 error for 90 files instead of 92. On a 2nd run, 90 errors again.

At this point it seems clear that the issue is on the Google side which is good for rclone but not so much for me :person_shrugging:

My only option seems to be retrying until I get all those objects, so I just grepped the paths that are returning 404 and piped them to a file. I'm looping through the file trying to rclone copy each object, hopefully this won't trigger any rate limits... let's see how that goes.

I don't know if you have a support contact with Google but you could ask them if you do.

It might be worth a search on Google Issue Tracker

You could use --files-from with your list of files which might be a bit easier.

1 Like

@dvdjaco can you try this

v1.59.0-beta.6141.d206761d2.fix-drive-resourcekey on branch fix-drive-resourcekey

This adds the resource key on download and server side copy which might help since I see the resource key in your dump above.

1 Like

That did work, thanks a lot!

It is still annoying me that I wasn't able to find out what caused this behavior in the first place, but that's one less thing to worry about now. Thanks again!