Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Unable to connect: Wrong type argument: symbolp, (id . "1555") #209

Open
rogorido opened this issue Oct 8, 2018 · 10 comments
Open

Unable to connect: Wrong type argument: symbolp, (id . "1555") #209

rogorido opened this issue Oct 8, 2018 · 10 comments
Labels

Comments

@rogorido
Copy link

rogorido commented Oct 8, 2018

Hi,

I'm all the time getting an error like:
Wrong type argument: symbolp, (id . "1555")

when I try to connect after having set the following:
(setq mastodon-instance-url "https://scholar.social")

Any ideas? (last melpa version installed)

@alexjgriffith
Copy link
Collaborator

This was an issue with the previous melpa release. 8.0 (20180811.220) should have fixed this. Do you mind looking in your elpa (~/.emacs.d/elpa/) file and checking which version of mastodon.el you have installed?

@rogorido
Copy link
Author

rogorido commented Oct 9, 2018

Thanks for your answer, but I have exactly this version (mastodon-20180811.220)...

@alexjgriffith
Copy link
Collaborator

  1. Looking a little bit deeper that id looks to be the length of an account id, so the error may be in how we handle the user profiles.

  2. I've signed up for scholar.social and logged in but was unable to recreate your error. If you're able to easily recreate this bug, could you turn on debugging via (setq debug-on-error 't) and post the resulting stack trace?

@rogorido
Copy link
Author

Thanks again for your comments.

Here is the error I get: http://ix.io/1oTV

@hdurer
Copy link
Collaborator

hdurer commented Oct 12, 2018

Looking at that error backtrace it looks very much like issue #144: We read the json response, binding json-object-type to 'plist but somehow the object in the response is still returned as an alist and not a plist which then later makes the plstore-put function (rightfully) barf.

I have not heard of any explanation for this behaviour - it is utterly baffling and not helped by the fact that none of us people working on the code can reproduce it.

Could you provide more information about your system? OS, emacs version, ...

And maybe could you evaluate this snippet in the scratch buffer and tell us what the result is?

(let ((json-object-type 'plist)
      (json-key-type 'keyword)
      (json-array-type 'vector))
  (json-read-from-string "{ \"a\": 1, \"b\": [10, 11, 12]}"))

@rogorido
Copy link
Author

Thanks again for your efforts.
To your questions:

  1. (:a 1 :b [10 11 12]) --> result of eval your code
  2. GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-07-05
  3. archlinux.

@hdurer
Copy link
Collaborator

hdurer commented Oct 12, 2018

Thanks. So result 1 shows that this json parsing is working as intended on your Emacs - that result is a plist (the alist would have been ((:a . 1) (:b 10 11 12))).

You are also not running an old version of Emacs or use an obscure OS (cough Windows cough)...

I honestly have no clue how you run into these issues. Could there be some old code lying around? (Possibly byte compiled so that it gets preferred over the new source?)

@alexjgriffith
Copy link
Collaborator

alexjgriffith commented Oct 12, 2018

Yes, its definitly an issue with mastodon-client--fetch

The following should return the plist you would add to plstore, but for some reason it returned an alist.

(list (concat "mastodon-" mastodon-instance-url) (mastodon-client--fetch) nil)

@rogorido if you run the above (after running (mastodon) to auto-load the required files) you should get

'("mastodon-https://scholar.social" (:id  "1565" :name  "mastodon.el" :website  "https://github.com/jdenen/mastodon.el" :redirect_uri "urn:ietf:wg:oauth:2.0:oob" :client_id "XXXXX" :client_secret  "XXXXX") nil)

If this is not what you get I'd recommend reinstalling mastodon.el and deleting ~/.emacs.d/mastodon.plstore.

If after that the problem persist, enter something like the following into your plstore file (with the actual client_id and client_secret you get in the debug log). This way the mastodon-client--store function will never be called.

;;; public entries -*- mode: plstore -*- 
(("mastodon-https://scholar.social" :id "1565" :name "mastodon.el" :website "https://github.com/jdenen/mastodon.el" :redirect_uri "urn:ietf:wg:oauth:2.0:oob" :client_id XXXX :client_secret XXXX))

@rogorido
Copy link
Author

I have in mastodon.plstore

;;; public entries -*- mode: plstore -*- (("mastodon-https://scholar.social" :id "1565" :name "mastodon.el" :website "https://github.com/jdenen/mastodon.el" :redirect_uri "urn:ietf:wg:oauth:2.0:oob" :client_id "XXX" :client_secret "XX"))

and it is strange: the first time I tried to connect I got actually a question about my username and password, but it did not connect (there was no error message... maybe it was my connection but I do not think so...). But now I get the same problem: http://ix.io/1p81

The config data seem to be two times there...

@jdenen jdenen added the bug label Nov 19, 2018
@ieure
Copy link
Contributor

ieure commented Dec 5, 2018

Any update on this? I'm seeing the same issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants