gauteh/lieer

Invalid label name ?

pazz opened this issue · 15 comments

pazz commented

I see this during gmi sync

Traceback (most recent call last):
  File "/home/pazz/projects/gmailieer/gmi", line 8, in <module>
    g.main ()
  File "/home/pazz/projects/gmailieer/lieer/gmailieer.py", line 143, in main
    args.func (args)
  File "/home/pazz/projects/gmailieer/lieer/gmailieer.py", line 193, in sync
    self.push (args, True)
  File "/home/pazz/projects/gmailieer/lieer/gmailieer.py", line 245, in push
    actions.append (self.remote.update (rm, nm, self.local.state.last_historyId, self.force))
  File "/home/pazz/projects/gmailieer/lieer/remote.py", line 109, in func_wrap
    return func (self, *args, **kwargs)
  File "/home/pazz/projects/gmailieer/lieer/remote.py", line 503, in update
    return self.__push_tags__ (gid, add, rem)
  File "/home/pazz/projects/gmailieer/lieer/remote.py", line 109, in func_wrap
    return func (self, *args, **kwargs)
  File "/home/pazz/projects/gmailieer/lieer/remote.py", line 519, in __push_tags__
    (lid, ll) = self.__create_label__ (a)
  File "/home/pazz/projects/gmailieer/lieer/remote.py", line 109, in func_wrap
    return func (self, *args, **kwargs)
  File "/home/pazz/projects/gmailieer/lieer/remote.py", line 630, in __create_label__
    lr = self.service.users ().labels ().create (userId = self.account, body = label).execute ()
  File "/usr/lib/python3/dist-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/googleapiclient/http.py", line 838, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/gmail/v1/users/octo%40gmail.com/labels?alt=json returned "Invalid label name">
pazz commented
pazz commented

Fixed in #53

pazz commented

I've encountered the same issue with Trash:

$ gmi sync
receiving metadata: 100%
resolving changes:   0%
push: creating label: Trash..
Traceback (most recent call last):
  File "/home/will/.venvs/gmailieer/bin/gmi", line 8, in <module>
    g.main ()
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/lieer/gmailieer.py", line 143, in main
    args.func (args)
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/lieer/gmailieer.py", line 193, in sync
    self.push (args, True)
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/lieer/gmailieer.py", line 245, in push
    actions.append (self.remote.update (rm, nm, self.local.state.last_historyId, self.force))
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/lieer/remote.py", line 110, in func_wrap
    return func (self, *args, **kwargs)
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/lieer/remote.py", line 510, in update
    return self.__push_tags__ (gid, add, rem)
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/lieer/remote.py", line 110, in func_wrap
    return func (self, *args, **kwargs)
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/lieer/remote.py", line 526, in __push_tags__
    (lid, ll) = self.__create_label__ (a)
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/lieer/remote.py", line 110, in func_wrap
    return func (self, *args, **kwargs)
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/lieer/remote.py", line 643, in __create_label__
    lr = self.service.users ().labels ().create (userId = self.account, body = label).execute ()
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/will/.venvs/gmailieer/lib/python3.6/site-packages/googleapiclient/http.py", line 844, in execute
    raise HttpError(resp, content, uri=self.uri)                                                                                                                                             
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/gmail/v1/users/myusername%40gmail.com/labels?alt=json returned "Invalid label name">

I've encountered the same issue with tag arxiv

$ gmi sync                                                                                                                                                                                                                      
receiving metadata: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 18432/18432 [03:21<00:00, 91.70it/s]
resolving changes:   0%|                                                                                                                                                                                            | 0/18432 [00:00<?, ?it/s]
update: remote has changed, will not update: 1695892c2ae41025 (add: [], rem: ['UNREAD']) (5256563 > 5256244)                                                                                                                                  
push: creating label: arxiv..                                                                                                                                                                                                                 
Traceback (most recent call last):                                                                                                                                                                                                            
  File "/usr/bin/gmi", line 8, in <module>
    g.main ()
  File "/usr/lib/python3.7/site-packages/lieer/gmailieer.py", line 155, in main
    args.func (args)
  File "/usr/lib/python3.7/site-packages/lieer/gmailieer.py", line 221, in sync
    self.push (args, True)
  File "/usr/lib/python3.7/site-packages/lieer/gmailieer.py", line 274, in push
    actions.append (self.remote.update (rm, nm, self.local.state.last_historyId, self.force))
  File "/usr/lib/python3.7/site-packages/lieer/remote.py", line 116, in func_wrap
    return func (self, *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/lieer/remote.py", line 536, in update
    return self.__push_tags__ (gid, add, rem)
  File "/usr/lib/python3.7/site-packages/lieer/remote.py", line 116, in func_wrap
    return func (self, *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/lieer/remote.py", line 552, in __push_tags__
    (lid, ll) = self.__create_label__ (a)
  File "/usr/lib/python3.7/site-packages/lieer/remote.py", line 116, in func_wrap
    return func (self, *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/lieer/remote.py", line 669, in __create_label__
    lr = self.service.users ().labels ().create (userId = self.account, body = label).execute ()
  File "/usr/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/googleapiclient/http.py", line 851, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/gmail/v1/users/myusername%40gmail.com/labels?alt=json returned "Invalid label name">  

Weird, I was able to add the label in the web gui. Would you mind trying there as well? Or re-trying from gmi?

It is weird. I am able to add the label in the web ui, and then assign tag arxiv in notmuch. Syncing, pushing, verything is fine. However, if there is no label arxiv gmail in the first place, and I assign this tag in notmuch, running gmi sync will cause problem.

I have had the same problem with the arxiv label.