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

ement-room-send-reply, ement-room-send-message signal "400: User is not hosted on this homeserver" #84

Closed
progfolio opened this issue Aug 10, 2022 · 10 comments
Labels

Comments

@progfolio
Copy link
Contributor

progfolio commented Aug 10, 2022

Forgive me if this is expected behavior, I'm not too familiar with the Matrix API.

When sending messages I consistently get the following backtrace:

Debugger entered--Lisp error: (ement-api-error "400: User is not hosted on this homeserver")
  signal(ement-api-error ("400: User is not hosted on this homeserver"))
  ement-api-error(#s(plz-error :curl-error nil :response #s(plz-response :version 2 :status 400 :headers ((date . "Wed, 10 Aug 2022 15:40:44 GMT") (content-type . "application/json") (synapse-trace-id . "6a18345d5ab46045") (cache-control . "no-cache, no-store, must-revalidate") (access-control-allow-origin . "*") (access-control-allow-methods . "GET, HEAD, POST, PUT, DELETE, OPTIONS") (access-control-allow-headers . "X-Requested-With, Content-Type, Authorization, Dat...") (permissions-policy . "interest-cohort=()") (cf-cache-status . "DYNAMIC") (expect-ct . "max-age=604800, report-uri=\"https://report-uri.clo...") (server . "cloudflare") (cf-ray . "7389d4e669248ce8-EWR")) :body "{\"errcode\":\"M_UNKNOWN\",\"error\":\"User is not hosted...") :message nil))
  plz--sentinel(#<process plz-request-curl<1>> "finished\n")
  ement-room-read-string("Send reply (Emacs): " nil nil nil inherit-input-method)
  ement-room-send-reply()
  funcall-interactively(ement-room-send-reply)
  command-execute(ement-room-send-reply)

I'm still able to send messages, but when running with a non-nil toggle-debug-on-error this gets in the way often.
The error is signaled regardless of what message I am responding or composing.

  • emacs-version: GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-08-02
  • ement version: built off commit c3a5628
@progfolio progfolio changed the title ement-room-send-reply signals "400: User is not hosted on this homeserver" ement-room-send-reply, ement-room-send-message signal "400: User is not hosted on this homeserver" Aug 10, 2022
@alphapapa
Copy link
Owner

Hi Nic,

I've never heard of that error before. Are you using the matrix.org homeserver? If not, I'd guess it's a problem with the homeserver.

@progfolio
Copy link
Contributor Author

Are you using the matrix.org homeserver?

I am.

Haven't had much time to dig into this, but I'm still able to reproduce.
Here's a backtrace:

Debugger entered--Lisp error: (ement-api-error "400: User is not hosted on this homeserver")
  signal(ement-api-error ("400: User is not hosted on this homeserver"))
  ement-api-error(#s(plz-error :curl-error nil :response #s(plz-response :version 2 :status 400 :headers
                                                                         ((date . "Sun, 21 Aug 2022 06:13:33 GMT")
                                                                          (content-type . "application/json")
                                                                          (synapse-trace-id . "68da9f2aba8f81e6")
                                                                          (cache-control . "no-cache, no-store, must-revalidate")
                                                                          (access-control-allow-origin . "*")
                                                                          (access-control-allow-methods . "GET, HEAD, POST, PUT, DELETE, OPTIONS")
                                                                          (access-control-allow-headers . "X-Requested-With, Content-Type, Authorization, Date")
                                                                          (permissions-policy . "interest-cohort=()")
                                                                          (cf-cache-status . "DYNAMIC")
                                                                          (expect-ct . "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"")
                                                                          (server . "cloudflare")
                                                                          (cf-ray . "73e139344b6f187d-EWR"))
                                                                         :body "{\"errcode\":\"M_UNKNOWN\",\"error\":\"User is not hosted on this homeserver\"}")
                               :message nil))
  plz--sentinel(#<process plz-request-curl<1>> "finished\n")
  ement-room-read-string("Send message (Emacs): " nil nil nil inherit-input-method)

And searching for that error message only turned up the following:

matrix-org/synapse#8520

I'll look into this more when I have time.

@alphapapa
Copy link
Owner

That seems bizarre. Here are the only two suggestions I can think of:

  1. Try setting the plz curl arguments to disable HTTP2. I doubt that will make any difference, though, since the response seems to be parsed correctly.
  2. Try making another account on matrix.org and see if it has the same problem.

Also, to clarify, does this happen when using any other client with that account?

@progfolio
Copy link
Contributor Author

progfolio commented Aug 31, 2022

Try setting the plz curl arguments to disable HTTP2. I doubt that will make any difference, though, since the response seems to be parsed correctly.

Added the --http1.1 option. No luck. I agree, though, that the response is parsed correctly.

Try making another account on matrix.org and see if it has the same problem.

Element wants me to use a unique email per matrix.org account.
Not sure if that's a requirement of the Matrix protocol itself or Element, but I'm too busy to set up a temp email account and a temp Element account to test this at the moment. I'll add a TODO to remind me when I have the time.

Also, to clarify, does this happen when using any other client with that account?

I have not encountered the issue in Element's web or Android front-end.
Have not tried any other Matrix clients other than ement.

@alphapapa
Copy link
Owner

Ok, please let me know when you have more information.

@progfolio
Copy link
Contributor Author

Still haven't had time to look into this, but I did have time to work around it in case anyone else bumps into this:

  (define-advice ement-api-error (:around (fn &rest args) "ignore-not-hosted-error")
    "Ignore a spurious(?) error from Matrix home server."
    (condition-case err
        (apply fn args)
      ((error)
       (unless (string-match-p "User is not hosted on this homeserver" (cadr err))
         (signal 'ement-api-error (cdr err))))))

@alphapapa
Copy link
Owner

Of all the references I can find to that error with Google, only one code path involves anything Ement does: sending typing notifications. But, of course, we don't send typing notifications for users other than ourselves (which is the case in which that error is sent), so I don't know how that error could be caused.

Are you using Pantalaimon?

@progfolio
Copy link
Contributor Author

Are you using Pantalaimon?

I am not.

@alphapapa
Copy link
Owner

I am stumped, then. :)

@alphapapa
Copy link
Owner

This appears to be explained by #114.

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