Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: '15bac9a5ba0b826b' in update_tags: self.mids[mid] #25

Closed
julian-klode opened this issue Jun 1, 2017 · 13 comments
Closed

KeyError: '15bac9a5ba0b826b' in update_tags: self.mids[mid] #25

julian-klode opened this issue Jun 1, 2017 · 13 comments
Labels

Comments

@julian-klode
Copy link
Contributor

julian-klode commented Jun 1, 2017

Traceback (most recent call last):
  File "/home/jak/bin/gmi", line 8, in <module>
    g.main ()
  File "/home/jak/Downloads/gmailieer/lieer/gmailieer.py", line 136, in main
    args.func (args)
  File "/home/jak/Downloads/gmailieer/lieer/gmailieer.py", line 190, in sync
    self.pull (args, True)
  File "/home/jak/Downloads/gmailieer/lieer/gmailieer.py", line 315, in pull
    self.partial_pull ()
  File "/home/jak/Downloads/gmailieer/lieer/gmailieer.py", line 463, in partial_pull
    r = self.local.update_tags (m, None, db)
  File "/home/jak/Downloads/gmailieer/lieer/local.py", line 303, in update_tags
    fname = self.mids[mid]
KeyError: '15bac9a5ba0b826b'```
@julian-klode
Copy link
Contributor Author

I was just doing the usual sync thing.

@julian-klode
Copy link
Contributor Author

I guess the correct thing to do is to just re-download the message if it went missing on the local disk for some reason (not sure why it went missing in the first place, but that's a different story).

@julian-klode
Copy link
Contributor Author

A full sync fixed it, BTW. Maybe a full sync should be triggered automatically in such a case? Or maybe there should be a warning if the files are missing, but fetch them and continue (so that you can run a full sync eventually when you have time).

@gauteh
Copy link
Owner

gauteh commented Jun 2, 2017 via email

@julian-klode
Copy link
Contributor Author

OK, so the message was available on the remote side (queried the gid of the message via API explorer) and I'm not aware of me changing tags on it - maybe locally, but I don't recall touching the emails remotely. It only disappeared locally but I'm not sure why.

@julian-klode
Copy link
Contributor Author

OK, I'm digging through the history list. Meta info from my log was:

Jun 02 00:38:09 jak-x230 gmi[9725]: remote historyId: 12103618
Jun 02 00:38:09 jak-x230 gmi[9725]: pull: partial synchronization.. (hid: 12103095)

In revision 12103168, the message and several others received the TRASH label:

  {
   "id": "12103168",
   "messages": [
    {
     "id": "15bac9a5ba0b826b",
     "threadId": "15bac9a5ba0b826b"
    },
    {
     "id": "15bac9a6ad3a52ce",
     "threadId": "15bac9a5ba0b826b"
    },
    {
     "id": "15baca3b0b0ba06c",
     "threadId": "15bac9a5ba0b826b"
    },
    {
     "id": "15baf137daaf5954",
     "threadId": "15bac9a5ba0b826b"
    },
    {
     "id": "15bb1608c62507f3",
     "threadId": "15bac9a5ba0b826b"
    },
    {
     "id": "15bb1bc17569b718",
     "threadId": "15bac9a5ba0b826b"
    },
    {
     "id": "15bb1fc16b05a649",
     "threadId": "15bac9a5ba0b826b"
    },
    {
     "id": "15c62fa47e0c5434",
     "threadId": "15bac9a5ba0b826b"
    },
    {
     "id": "15c65baf1cd5b23d",
     "threadId": "15bac9a5ba0b826b"
    }
   ],
   "labelsAdded": [
    {
     "message": {
      "id": "15bac9a5ba0b826b",
      "threadId": "15bac9a5ba0b826b",
      "labelIds": [
       "IMPORTANT",
       "Label_41",
       "CATEGORY_PERSONAL",
       "TRASH",
       "SENT"
      ]
     },
     "labelIds": [
      "TRASH"
     ]
    },
    {
     "message": {
      "id": "15bac9a6ad3a52ce",
      "threadId": "15bac9a5ba0b826b",
      "labelIds": [
       "IMPORTANT",
       "Label_41",
       "CATEGORY_PERSONAL",
       "TRASH",
       "SENT"
      ]
     },
     "labelIds": [
      "TRASH"
     ]
    },
    {
     "message": {
      "id": "15baca3b0b0ba06c",
      "threadId": "15bac9a5ba0b826b",
      "labelIds": [
       "IMPORTANT",
       "Label_41",
       "CATEGORY_PERSONAL",
       "TRASH"
      ]
     },
     "labelIds": [
      "TRASH"
     ]
    },
    {
     "message": {
      "id": "15baf137daaf5954",
      "threadId": "15bac9a5ba0b826b",
      "labelIds": [
       "IMPORTANT",
       "Label_41",
       "CATEGORY_PERSONAL",
       "TRASH",
       "Label_12"
      ]
     },
     "labelIds": [
      "TRASH"
     ]
    },
    {
     "message": {
      "id": "15bb1608c62507f3",
      "threadId": "15bac9a5ba0b826b",
      "labelIds": [
       "IMPORTANT",
       "Label_41",
       "CATEGORY_PERSONAL",
       "TRASH",
       "SENT"
      ]
     },
     "labelIds": [
      "TRASH"
     ]
    },
    {
     "message": {
      "id": "15bb1bc17569b718",
      "threadId": "15bac9a5ba0b826b",
      "labelIds": [
       "IMPORTANT",
       "Label_41",
       "CATEGORY_PERSONAL",
       "TRASH",
       "SENT"
      ]
     },
     "labelIds": [
      "TRASH"
     ]
    },
    {
     "message": {
      "id": "15bb1fc16b05a649",
      "threadId": "15bac9a5ba0b826b",
      "labelIds": [
       "IMPORTANT",
       "Label_41",
       "CATEGORY_PERSONAL",
       "TRASH",
       "Label_12"
      ]
     },
     "labelIds": [
      "TRASH"
     ]
    },
    {
     "message": {
      "id": "15c62fa47e0c5434",
      "threadId": "15bac9a5ba0b826b",
      "labelIds": [
       "IMPORTANT",
       "CATEGORY_PERSONAL",
       "TRASH",
       "SENT"
      ]
     },
     "labelIds": [
      "TRASH"
     ]
    },
    {
     "message": {
      "id": "15c65baf1cd5b23d",
      "threadId": "15bac9a5ba0b826b",
      "labelIds": [
       "CATEGORY_PERSONAL",
       "TRASH",
       "Label_12",
       "INBOX"
      ]
     },
     "labelIds": [
      "TRASH"
     ]
    }
   ]
  },

@julian-klode
Copy link
Contributor Author

Ah no, there was an earlier failure:

Jun 02 00:23:09 jak-x230 gmi[12218]: remote historyId: 12103548
Jun 02 00:23:09 jak-x230 gmi[12218]: pull: partial synchronization.. (hid: 12103095)

I also just noticed that the trash label adding revision 12103168 is not the same as the one from the gmi output: 12103618.

@julian-klode
Copy link
Contributor Author

So the changes to that message on the remote side were:

12103168 +TRASH
12103211 -TRASH
12103807 -Label_41

I guess the culprit might be the +TRASH -TRASH pair in the same pull?

@gauteh
Copy link
Owner

gauteh commented Jun 2, 2017 via email

@julian-klode
Copy link
Contributor Author

I believe inside the if 'labelsRemoved' in h: case of Gmailiieer.partial_pull(), it checks # in case a not_sync tag has been added and removes stuff from added lists, and (re-)adds to the deleted list. But the not_sync tag has been removed there, not added, so it's the wrong way around AFAICT.

@gauteh
Copy link
Owner

gauteh commented Jun 2, 2017 via email

@gauteh gauteh added the bug label Jun 2, 2017
julian-klode added a commit to julian-klode/gmailieer that referenced this issue Jun 2, 2017
The gmail API fails with an error otherwise.

fixes gauteh#25
julian-klode added a commit to julian-klode/gmailieer that referenced this issue Jun 2, 2017
The gmail API fails with an error otherwise.

fixes gauteh#25
@julian-klode
Copy link
Contributor Author

I had that issue again (with an email I archived remotely IIRC), and it started working again after I trashed and untrashed the message in question in the gmail web UI.

@gauteh
Copy link
Owner

gauteh commented Aug 7, 2017

I think this should no longer be an issue since TRASH and SPAM messages are synced.

@gauteh gauteh closed this as completed Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants