400 INVALID_ARGUMENT sync Google Photo

What is the problem you are having with rclone?

I get an error message when syncing with Google Photo when rclone tries to delete a picture in Google Photo

What is your rclone version (output from rclone version)

rclone v1.55.0-beta.5347.20c5ca08f

  • os/type: linux
  • os/arch: amd64
  • go/version: go1.16.2
  • go/linking: static
  • go/tags: cmount

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu 20.04

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

Google Photo

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

rclone sync /mnt/fotoram/Sovrum Google:album/Test

A log from the command with the -vv flag

2021/03/30 08:57:51 DEBUG : Using config file from "/home/ressof/.config/rclone/rclone.conf"
2021/03/30 08:57:51 DEBUG : rclone: Version "v1.55.0-beta.5347.20c5ca08f" starting with parameters ["rclone" "sync" "/mnt/fotoram/Sovrum" "Google:album/Test" "-vv"]
2021/03/30 08:57:51 DEBUG : Creating backend with remote "/mnt/fotoram/Sovrum"
2021/03/30 08:57:51 DEBUG : Creating backend with remote "Google:album/Test"
2021/03/30 08:57:51 DEBUG : Google Photos path "album/Test": List: dir=""
2021/03/30 08:57:53 DEBUG : Google Photos path "album/Test": >List: err=<nil>
2021/03/30 08:57:53 DEBUG : IMG_20210322_140629.JPG: Size:
2021/03/30 08:57:53 DEBUG : IMG_20210322_140629.JPG: >Size:
2021/03/30 08:57:53 DEBUG : IMG_20210322_140632.JPG: Size:
2021/03/30 08:57:53 DEBUG : IMG_20210322_140632.JPG: >Size:
2021/03/30 08:57:53 DEBUG : IMG_20210322_140632.JPG: Size:
2021/03/30 08:57:53 DEBUG : IMG_20210322_140632.JPG: >Size:
2021/03/30 08:57:53 DEBUG : IMG_20210322_140632.JPG: Sizes identical
2021/03/30 08:57:53 DEBUG : IMG_20210322_140632.JPG: Unchanged skipping
2021/03/30 08:57:53 DEBUG : Google Photos path "album/Test": Waiting for checks to finish
2021/03/30 08:57:53 DEBUG : Google Photos path "album/Test": Waiting for transfers to finish
2021/03/30 08:57:53 DEBUG : Waiting for deletions to finish
2021/03/30 08:57:53 DEBUG : IMG_20210322_140629.JPG: Size:
2021/03/30 08:57:53 DEBUG : IMG_20210322_140629.JPG: >Size:
2021/03/30 08:57:54 ERROR : IMG_20210322_140629.JPG: Couldn't delete: couldn't delete item from album: Request contains an invalid media item id. (400 INVALID_ARGUMENT)
2021/03/30 08:57:54 ERROR : Google Photos path "album/Test": not deleting directories as there were IO errors
2021/03/30 08:57:54 ERROR : Attempt 1/3 failed with 2 errors and: failed to delete 1 files
2021/03/30 08:57:54 DEBUG : Google Photos path "album/Test": List: dir=""
2021/03/30 08:57:55 DEBUG : Google Photos path "album/Test": >List: err=<nil>
2021/03/30 08:57:55 DEBUG : IMG_20210322_140629.JPG: Size:
2021/03/30 08:57:55 DEBUG : IMG_20210322_140629.JPG: >Size:
2021/03/30 08:57:55 DEBUG : IMG_20210322_140632.JPG: Size:
2021/03/30 08:57:55 DEBUG : IMG_20210322_140632.JPG: >Size:
2021/03/30 08:57:55 DEBUG : IMG_20210322_140632.JPG: Size:
2021/03/30 08:57:55 DEBUG : IMG_20210322_140632.JPG: >Size:
2021/03/30 08:57:55 DEBUG : IMG_20210322_140632.JPG: Sizes identical
2021/03/30 08:57:55 DEBUG : IMG_20210322_140632.JPG: Unchanged skipping
2021/03/30 08:57:55 DEBUG : Google Photos path "album/Test": Waiting for checks to finish
2021/03/30 08:57:55 DEBUG : Google Photos path "album/Test": Waiting for transfers to finish
2021/03/30 08:57:55 DEBUG : Waiting for deletions to finish
2021/03/30 08:57:55 DEBUG : IMG_20210322_140629.JPG: Size:
2021/03/30 08:57:55 DEBUG : IMG_20210322_140629.JPG: >Size:
2021/03/30 08:57:56 ERROR : IMG_20210322_140629.JPG: Couldn't delete: couldn't delete item from album: Request contains an invalid media item id. (400 INVALID_ARGUMENT)
2021/03/30 08:57:56 ERROR : Google Photos path "album/Test": not deleting directories as there were IO errors
2021/03/30 08:57:56 ERROR : Attempt 2/3 failed with 2 errors and: failed to delete 1 files
2021/03/30 08:57:56 DEBUG : Google Photos path "album/Test": List: dir=""
2021/03/30 08:57:57 DEBUG : Google Photos path "album/Test": >List: err=<nil>
2021/03/30 08:57:57 DEBUG : IMG_20210322_140629.JPG: Size:
2021/03/30 08:57:57 DEBUG : IMG_20210322_140629.JPG: >Size:
2021/03/30 08:57:57 DEBUG : IMG_20210322_140632.JPG: Size:
2021/03/30 08:57:57 DEBUG : IMG_20210322_140632.JPG: >Size:
2021/03/30 08:57:57 DEBUG : IMG_20210322_140632.JPG: Size:
2021/03/30 08:57:57 DEBUG : IMG_20210322_140632.JPG: >Size:
2021/03/30 08:57:57 DEBUG : IMG_20210322_140632.JPG: Sizes identical
2021/03/30 08:57:57 DEBUG : IMG_20210322_140632.JPG: Unchanged skipping
2021/03/30 08:57:57 DEBUG : Google Photos path "album/Test": Waiting for checks to finish
2021/03/30 08:57:57 DEBUG : Google Photos path "album/Test": Waiting for transfers to finish
2021/03/30 08:57:57 DEBUG : Waiting for deletions to finish
2021/03/30 08:57:57 DEBUG : IMG_20210322_140629.JPG: Size:
2021/03/30 08:57:57 DEBUG : IMG_20210322_140629.JPG: >Size:
2021/03/30 08:57:58 ERROR : IMG_20210322_140629.JPG: Couldn't delete: couldn't delete item from album: Request contains an invalid media item id. (400 INVALID_ARGUMENT)
2021/03/30 08:57:58 ERROR : Google Photos path "album/Test": not deleting directories as there were IO errors
2021/03/30 08:57:58 ERROR : Attempt 3/3 failed with 2 errors and: failed to delete 1 files
2021/03/30 08:57:58 INFO  :
Transferred:             0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors:                 2 (retrying may help)
Checks:                 6 / 6, 100%
Deleted:                3 (files), 0 (dirs)
Elapsed time:         7.3s

2021/03/30 08:57:58 DEBUG : 3 go routines active
2021/03/30 08:57:58 Failed to sync with 2 errors: last error was: failed to delete 1 files

I'm not sure what is going on there... All the IDs rclone gets are from google photos. I wonder if rclone tried to delete the same item twice or something like that.

Can you repeat your test with -vv --dump bodies --log-file rclone.log --retries 1 and attach the rclone.log or put it somewhere I can see it - thanks!

Here is the output from that command

https://pastebin.com/EW9zeSfy

Thanks.

The media item in question AOU0YFy60lAlq1LOE6g2joEt-CstsEeHdi1-0Q-xNKVrtUkW-ptXfH7gXD6MpJk4xwjxz1iBt9hkXtkN_tihAzBbH6NstQBikA looks sensible.

However I notice it appears twice in your log once as a normal item and once here as a coverPhotoMediaItemId - I wonder if that is making the difference - so maybe rclone can't delete it because it is the cover photo? Can you try removing it as a cover photo?

    {
      "id": "AOU0YFxuVa1UiUzoolpBBT3MrrTp2VHMJzbtkEgPt-xN4aZf0ZlvGkafVAdmjyAUX7TAgB_4sdaL",
      "title": "Test",
      "productUrl": "https://photos.google.com/lr/album/AOU0YFxuVa1UiUzoolpBBT3MrrTp2VHMJzbtkEgPt-xN4aZf0ZlvGkafVAdmjyAUX7TAgB_4sdaL",
      "isWriteable": true,
      "mediaItemsCount": "2",
      "coverPhotoBaseUrl": "https://lh3.googleusercontent.com/lr/AFBm1_a0S3xUl1bCCTKETBOU6ybLnC7t2788LehlmjXdx8nspFD1Uu5tBiF-aAXoOsUWJZs4v33VIFJOL652MHMiaQLadyM-x6MsPegg6fMXcltwXKOyXJKzmBqw3lz3oG9GhRbWVRgbpLLwJUrnMYiLMsV41_AopDCD1ST6honyl-yL5tBlq8aKymt6txJtDiWa2Nq7ueM-xnIFRHU1qBkBUvgH2w77UiYMf0sIL7-Xh_dmNeXmnMwdapyt2LXnPSfP56KH0RKtIJb2mY4xbxK_18qF-yGk72r9g2G_NbrKsNS4AtHuqxN6Xhd-Lv8A3JXdCzXdNXs1TYRbATYmX_kPzBUuQ8GRfht42dGMc",
      "coverPhotoMediaItemId": "AOU0YFy60lAlq1LOE6g2joEt-CstsEeHdi1-0Q-xNKVrtUkW-ptXfH7gXD6MpJk4xwjxz1iBt9hkXtkN_tihAzBbH6NstQBikA"
    }

I changed the cover picture but I got the same error.

Can you remove that image by hand?

Yes.
I have done more test with a fresh album created by rclone and I get the same error when rclone tries to remove a photo.

When i allow rclone access to google photo I get this text. It doesnt say anything about delete here.
Skärmklipp
I have to use manual setup because im on a headless system.

You are right. I can't delete files either with the same (very confusing!) error.

If I look at the scopes page: Authorization scopes  |  Google Photos APIs  |  Google Developers

There doesn't appear to be any scopes which let you delete files any more - would you agree?

Rclone requests this scope https://www.googleapis.com/auth/photoslibrary which until releatively recently let you delete things out of albums.

I wonder if google have changed the scopes...

1 Like

Yeah it seems they have changed their API. But I can't find anything on it on the web.

Can you please make a new issue on github about this please and we'll look into it further - thanks! If you could link the forum from the issue and vice versa it helps with discovery.

Here are the link to the issue on github
https://github.com/rclone/rclone/issues/5192

2 Likes

Now it seems to work. Maybe a glitch in Google API?

Will reply on issue