Magit: *ERROR*: Auth Error: "Token not found" while committing

Created on 26 Aug 2017  Â·  5Comments  Â·  Source: magit/magit

A few users have reported this error:

  1 git … commit --
Waiting for Emacs...
*ERROR*: Auth Error: "Token not found"
error: There was a problem with the editor '/path/to/emacsclient ...'.
Please supply the message using either -m or -F option.

The Auth Error: "Token not found" comes from ghub, whose maintainer I am. Magit does not use ghub yet, because it not very user friendly yet and generally not ready for prime time. This error has nothing to do with committing (at least as far as Magit is concerned), it just happens to be triggered during committing.

While Magit does not use ghub, the extension magithub does. I do suspect that that package triggers this error, but I am not sure. Currently ghub just raises an error if things don't work out and expect the caller to deal with it. Obviously the caller is not doing that in this case.

@vermiculus Let's assume that it is magithub. Why does it make an api call when the user commits? If it doesn't do it explicitly when committing but for a set of "events" including committing, would it be possible to disable it for committing?

Also based on user reports it seems this only happens when committing, but not when doing other things like refreshing the status buffer. Or maybe it happens then also, but the error is silently suppressed? Would it be possible to do the same while committing?

@syl20bnr To complicate things further it seems that Spacemacs installs magithub, or at least I have been told that it does. That's a problem because if the user is not aware that s/he has to setup a token, then s/he won't do it. As I have mentioned before, it appears that magithub silently ignores the resulting errors - except while committing.


I don't actually have the time to investigate this myself right now. While the error ultimately happens in ghub and is triggered by doing something in Magit (both of which I maintain), the issue is caused by a third-party package whose identity has not been fully established yet.

Most helpful comment

For this case, I'll see what I can do about handling the error gracefully (i.e., not turning on bug-reference-mode at all). In general though, I'm in favor of passing that error up until magit/ghub#25 is ready.

Sounds like a good plan. I will try to finish the refactoring soon.

All 5 comments

Re making requests while committing: the only thing I do is enabled bug-reference-mode (via magithub-bug-reference-mode-on). I do set bug-reference-url-format to (format "%s/issues/%%s" (alist-get 'html_url repo)) to allow jumping right to an issue/PR from the commit buffer. (If there's a way to delay this – only get repo data when it's required – I'm eager to implement that.)

You can deactivate it entirely by removing the hooks set by this code inmagithub-core.el:

(eval-after-load "magit"
  '(dolist (hook '(magit-revision-mode-hook git-commit-setup-hook))
     (add-hook hook #'magithub-bug-reference-mode-on)))

For this case, I'll see what I can do about handling the error gracefully (i.e., not turning on bug-reference-mode at all). In general though, I'm in favor of passing that error up until magit/ghub#25 is ready.

I do notice that I don't filter on magithub-usable-p before I make the API call. That's an oversight on my part that I should fix – it might be that users can disable magithub in the status buffer and avoid making API calls there, but I'm not respecting that setting in the commit buffer.

Thanks for the mention. We have discussed recently about removing magithub
from the GitHub layer as the project took another direction and
@vermiculus, you said somewhere that you cannot work on the project for
now. Our decision was to disable the package until the new direction is
implemented (which looks exciting).

Le sam. 26 août 2017 à 14:30, Sean Allred notifications@github.com a
écrit :

Re making requests while committing: the only thing I do is enabled
bug-reference-mode (via magithub-bug-reference-mode-on). I do set
bug-reference-url-format to (format "%s/issues/%%s" (alist-get 'html_url
repo)) to allow jumping right to an issue/PR from the commit buffer. (If
there's a way to delay this – only get repo data when it's required – I'm
eager to implement that.)

You can deactivate it entirely by removing the hooks set by this code in
magithub-core.el:

(eval-after-load "magit"
'(dolist (hook '(magit-revision-mode-hook git-commit-setup-hook))
(add-hook hook #'magithub-bug-reference-mode-on)))

For this case, I'll see what I can do about handling the error gracefully
(i.e., not turning on bug-reference-mode at all). In general though, I'm in
favor of passing that error up until magit/ghub#25
https://github.com/magit/ghub/issues/25 is ready.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/magit/magit/issues/3154#issuecomment-325154173, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABL5keRTLtjEUV9vDDBv0DkvhAb3lthsks5scGRXgaJpZM4PDk4l
.

>

-syl20bnr-

@syl20bnr, looks like you're referring to syl20bnr/spacemacs#9288. While I was on somewhat of a hiatus to focus on my day job, I'm back now 😄 Work is slow but steady. There will be one more weird period when magit/ghub#25 goes through, but after that I don't anticipate any more crazy instability.

That's great news! I disabled the package for now, don't hesitate to warn
us when you think the package is stable enough and we will activate it back.

-syl20bnr-

On Sun, Aug 27, 2017 at 11:53 AM, Sean Allred notifications@github.com
wrote:

@syl20bnr https://github.com/syl20bnr, looks like you're referring to
syl20bnr/spacemacs#9288
https://github.com/syl20bnr/spacemacs/issues/9288. While I was on
somewhat of a hiatus to focus on my day job, I'm back now 😄 Work is slow
but steady. There will be one more weird period when magit/ghub#25
https://github.com/magit/ghub/issues/25 goes through, but after that I
don't anticipate any more crazy instability.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/magit/magit/issues/3154#issuecomment-325206819, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABL5kReg7D4FL7Lu4wJK3GT41mY6MrVUks5scZDngaJpZM4PDk4l
.

For this case, I'll see what I can do about handling the error gracefully (i.e., not turning on bug-reference-mode at all). In general though, I'm in favor of passing that error up until magit/ghub#25 is ready.

Sounds like a good plan. I will try to finish the refactoring soon.

Was this page helpful?
0 / 5 - 0 ratings