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

I am getting "wrong-type-argument sequencep 1" on all list pages #53

Closed
christofdamian opened this issue Jul 23, 2024 · 12 comments
Closed
Assignees
Labels
Milestone

Comments

@christofdamian
Copy link

My Emacs debugging skills are not great.
This happens whenever there is a search, and therefore also on the first page.

This is the backtrace:

Debugger entered--Lisp error: (wrong-type-argument sequencep 1)
  pocket-reader--get-items(nil)
  pocket-reader-search(nil)
  pocket-reader-refresh()
  pocket-reader-mode()
  pocket-reader()
  funcall-interactively(pocket-reader)
  command-execute(pocket-reader)

I can try other things if that were helpful for debugging.

@alphapapa
Copy link
Owner

This package works correctly for me. Please try to reproduce the problem in a clean Emacs configuration, e.g. using https://github.com/alphapapa/with-emacs.sh (./with-emacs.sh -i pocket-reader).

@christofdamian
Copy link
Author

That does indeed work. I will have to bisect my config.
Sorry for the noise.

@christofdamian
Copy link
Author

This was the cause, btw. I had this in my custom-set-variables, as I previously had problems with empty amp_urls.

(pocket-reader-url-priorities '(resolved_url given_url amp_url))

Thanks for pointing me in the right direction.

@alphapapa
Copy link
Owner

This was the cause, btw. I had this in my custom-set-variables, as I previously had problems with empty amp_urls.

(pocket-reader-url-priorities '(resolved_url given_url amp_url))

Thanks for pointing me in the right direction.

I don't understand why that would cause this problem. That may suggest a bug after all.

If you can, please re-evaluate the pocket-reader.el file (i.e. to make its functions non-byte-compiled), then cause the error again, and provide the full backtrace.

@alphapapa alphapapa reopened this Jul 24, 2024
@alphapapa alphapapa self-assigned this Jul 24, 2024
@alphapapa alphapapa added the bug label Jul 24, 2024
@christofdamian
Copy link
Author

This is happening to me again, even with with-emacs.sh and removing the pocket-reader-url-priorities customization.

This time I managed to get a hopefully more helpful backtraces.

My Emacs is: GNU Emacs 29.4 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.42, cairo version 1.18.0) of 2024-07-16

Firstly, just the overview:

Debugger entered--Lisp error: (wrong-type-argument sequencep 1)
  length(1)
  (> (length items) 0)
  (if (> (length items) 0) (progn items))
  (let* ((query (or query "")) (parsed (pocket-reader--parse-query query)) (states (remq nil (list (if (plist-get parsed :archive) (progn "archive")) (if (plist-get parsed :all) (progn "all")) (if (plist-get parsed :unread) (progn "unread"))))) (state (progn (if states (progn (if (= 1 ...) nil (user-error "Only one of :archive, :all, or :unread may be used")))) (car states))) (favorite (if (plist-get parsed :favorite) (progn 1))) (count (setq pocket-reader-show-count (or (plist-get parsed :count) pocket-reader-show-count))) (tag (plist-get parsed :tag)) (query-string (s-join " " (plist-get parsed :words))) (items (cdr (car (cdr (cdr (pocket-lib-get :detail-type "complete" :count count :offset pocket-reader-offset :search query-string :state state :favorite favorite :tag tag))))))) (if (> (length items) 0) (progn items)))
  pocket-reader--get-items(nil)
  (let ((items (pocket-reader--get-items query))) (if items (progn (setq pocket-reader-queries (if (cl-member query pocket-reader-queries :test #'string=) pocket-reader-queries (cons query pocket-reader-queries))) (pocket-reader--add-items items)) (cond ((eql pocket-reader-offset '0) (message "No items for query: %s" query)) (t (message "No more items for query: %s" query)))))
  (progn (if (or current-prefix-arg add) nil (goto-char (point-min)) (custom-reevaluate-setting 'pocket-reader-show-count) (pocket-reader-unmark-all) (progn (setq pocket-reader-offset 0) (setq pocket-reader-queries nil) (setq pocket-reader-items (let ((ht-temp (make-hash-table :test ...))) ht-temp)))) (let ((items (pocket-reader--get-items query))) (if items (progn (setq pocket-reader-queries (if (cl-member query pocket-reader-queries :test #'string=) pocket-reader-queries (cons query pocket-reader-queries))) (pocket-reader--add-items items)) (cond ((eql pocket-reader-offset '0) (message "No items for query: %s" query)) (t (message "No more items for query: %s" query))))))
  (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:add :allow-other-keys)) (if (cdr --cl-keys--) nil (error "Missing argument for %s" (car --cl-keys--))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ... --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:add)" (car --cl-keys--)))))) (progn (if (or current-prefix-arg add) nil (goto-char (point-min)) (custom-reevaluate-setting 'pocket-reader-show-count) (pocket-reader-unmark-all) (progn (setq pocket-reader-offset 0) (setq pocket-reader-queries nil) (setq pocket-reader-items (let ((ht-temp ...)) ht-temp)))) (let ((items (pocket-reader--get-items query))) (if items (progn (setq pocket-reader-queries (if (cl-member query pocket-reader-queries :test ...) pocket-reader-queries (cons query pocket-reader-queries))) (pocket-reader--add-items items)) (cond ((eql pocket-reader-offset '0) (message "No items for query: %s" query)) (t (message "No more items for query: %s" query)))))))
  (let* ((add (car (cdr (plist-member --cl-rest-- ':add))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '...) (if (cdr --cl-keys--) nil (error "Missing argument for %s" ...)) (setq --cl-keys-- (cdr ...))) ((car (cdr ...)) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:add)" (car --cl-keys--)))))) (progn (if (or current-prefix-arg add) nil (goto-char (point-min)) (custom-reevaluate-setting 'pocket-reader-show-count) (pocket-reader-unmark-all) (progn (setq pocket-reader-offset 0) (setq pocket-reader-queries nil) (setq pocket-reader-items (let (...) ht-temp)))) (let ((items (pocket-reader--get-items query))) (if items (progn (setq pocket-reader-queries (if ... pocket-reader-queries ...)) (pocket-reader--add-items items)) (cond ((eql pocket-reader-offset ...) (message "No items for query: %s" query)) (t (message "No more items for query: %s" query))))))))
  pocket-reader-search(nil)
  (let ((queries (cdr pocket-reader-queries))) (pocket-reader-search (car pocket-reader-queries)) (let ((list queries) (i 0)) (while list (let ((it (car-safe (prog1 list ...))) (it-index i)) (ignore it it-index) (pocket-reader-search it :add t)) (setq i (1+ i)))))
  (cond ((eql temp '1) (pocket-reader-search (car pocket-reader-queries))) (t (let ((queries (cdr pocket-reader-queries))) (pocket-reader-search (car pocket-reader-queries)) (let ((list queries) (i 0)) (while list (let ((it ...) (it-index i)) (ignore it it-index) (pocket-reader-search it :add t)) (setq i (1+ i)))))))
  (let* ((temp (length pocket-reader-queries))) (cond ((eql temp '1) (pocket-reader-search (car pocket-reader-queries))) (t (let ((queries (cdr pocket-reader-queries))) (pocket-reader-search (car pocket-reader-queries)) (let ((list queries) (i 0)) (while list (let (... ...) (ignore it it-index) (pocket-reader-search it :add t)) (setq i (1+ i))))))))
  (let ((first-line-visible-p (pos-visible-in-window-p (point-min)))) (let* ((temp (length pocket-reader-queries))) (cond ((eql temp '1) (pocket-reader-search (car pocket-reader-queries))) (t (let ((queries (cdr pocket-reader-queries))) (pocket-reader-search (car pocket-reader-queries)) (let ((list queries) (i 0)) (while list (let ... ... ...) (setq i ...))))))) (if first-line-visible-p (progn (let ((pos (point))) (goto-char (point-min)) (redisplay) (goto-char pos)))))
  pocket-reader-refresh()
  (let ((delay-mode-hooks t)) (tabulated-list-mode) (setq major-mode 'pocket-reader-mode) (setq mode-name "Pocket Reader") (progn (if (get 'tabulated-list-mode 'mode-class) (put 'pocket-reader-mode 'mode-class (get 'tabulated-list-mode 'mode-class))) (if (keymap-parent pocket-reader-mode-map) nil (set-keymap-parent pocket-reader-mode-map (current-local-map))) (let ((parent (char-table-parent pocket-reader-mode-syntax-table))) (if (and parent (not (eq parent (standard-syntax-table)))) nil (set-char-table-parent pocket-reader-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get pocket-reader-mode-abbrev-table :parents) (eq pocket-reader-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put pocket-reader-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map pocket-reader-mode-map) (set-syntax-table pocket-reader-mode-syntax-table) (setq local-abbrev-table pocket-reader-mode-abbrev-table) (advice-add 'tabulated-list--sort-by-column-name :after 'pocket-reader--finalize) (add-hook 'kill-buffer-hook #'(lambda nil (advice-remove 'tabulated-list--sort-by-column-name 'pocket-reader--finalize)) 'append 'local) (setq tabulated-list-sort-key '("Added")) (setq pocket-reader-queries pocket-reader-default-queries) (pocket-reader-refresh) (if (cdr tabulated-list-sort-key) nil (tabulated-list-sort 0)))
  (progn (make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks t)) (tabulated-list-mode) (setq major-mode 'pocket-reader-mode) (setq mode-name "Pocket Reader") (progn (if (get 'tabulated-list-mode 'mode-class) (put 'pocket-reader-mode 'mode-class (get 'tabulated-list-mode 'mode-class))) (if (keymap-parent pocket-reader-mode-map) nil (set-keymap-parent pocket-reader-mode-map (current-local-map))) (let ((parent (char-table-parent pocket-reader-mode-syntax-table))) (if (and parent (not (eq parent ...))) nil (set-char-table-parent pocket-reader-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get pocket-reader-mode-abbrev-table :parents) (eq pocket-reader-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put pocket-reader-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map pocket-reader-mode-map) (set-syntax-table pocket-reader-mode-syntax-table) (setq local-abbrev-table pocket-reader-mode-abbrev-table) (advice-add 'tabulated-list--sort-by-column-name :after 'pocket-reader--finalize) (add-hook 'kill-buffer-hook #'(lambda nil (advice-remove 'tabulated-list--sort-by-column-name 'pocket-reader--finalize)) 'append 'local) (setq tabulated-list-sort-key '("Added")) (setq pocket-reader-queries pocket-reader-default-queries) (pocket-reader-refresh) (if (cdr tabulated-list-sort-key) nil (tabulated-list-sort 0))))
  pocket-reader-mode()
  pocket-reader()
  funcall-interactively(pocket-reader)
  command-execute(pocket-reader record)
  execute-extended-command(nil "pocket-reader" "pocket-re")
  funcall-interactively(execute-extended-command nil "pocket-reader" "pocket-re")
  command-execute(execute-extended-command)

Now search for :archive

Debugger entered--Lisp error: (wrong-type-argument sequencep 1)
  length(1)
  (> (length items) 0)
  (if (> (length items) 0) (progn items))
  (let* ((query (or query "")) (parsed (pocket-reader--parse-query query)) (states (remq nil (list (if (plist-get parsed :archive) (progn "archive")) (if (plist-get parsed :all) (progn "all")) (if (plist-get parsed :unread) (progn "unread"))))) (state (progn (if states (progn (if (= 1 ...) nil (user-error "Only one of :archive, :all, or :unread may be used")))) (car states))) (favorite (if (plist-get parsed :favorite) (progn 1))) (count (setq pocket-reader-show-count (or (plist-get parsed :count) pocket-reader-show-count))) (tag (plist-get parsed :tag)) (query-string (s-join " " (plist-get parsed :words))) (items (cdr (car (cdr (cdr (pocket-lib-get :detail-type "complete" :count count :offset pocket-reader-offset :search query-string :state state :favorite favorite :tag tag))))))) (if (> (length items) 0) (progn items)))
  pocket-reader--get-items(":archive")
  (let ((items (pocket-reader--get-items query))) (if items (progn (setq pocket-reader-queries (if (cl-member query pocket-reader-queries :test #'string=) pocket-reader-queries (cons query pocket-reader-queries))) (pocket-reader--add-items items)) (cond ((eql pocket-reader-offset '0) (message "No items for query: %s" query)) (t (message "No more items for query: %s" query)))))
  (progn (if (or current-prefix-arg add) nil (goto-char (point-min)) (custom-reevaluate-setting 'pocket-reader-show-count) (pocket-reader-unmark-all) (progn (setq pocket-reader-offset 0) (setq pocket-reader-queries nil) (setq pocket-reader-items (let ((ht-temp (make-hash-table :test ...))) ht-temp)))) (let ((items (pocket-reader--get-items query))) (if items (progn (setq pocket-reader-queries (if (cl-member query pocket-reader-queries :test #'string=) pocket-reader-queries (cons query pocket-reader-queries))) (pocket-reader--add-items items)) (cond ((eql pocket-reader-offset '0) (message "No items for query: %s" query)) (t (message "No more items for query: %s" query))))))
  (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '(:add :allow-other-keys)) (if (cdr --cl-keys--) nil (error "Missing argument for %s" (car --cl-keys--))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ... --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:add)" (car --cl-keys--)))))) (progn (if (or current-prefix-arg add) nil (goto-char (point-min)) (custom-reevaluate-setting 'pocket-reader-show-count) (pocket-reader-unmark-all) (progn (setq pocket-reader-offset 0) (setq pocket-reader-queries nil) (setq pocket-reader-items (let ((ht-temp ...)) ht-temp)))) (let ((items (pocket-reader--get-items query))) (if items (progn (setq pocket-reader-queries (if (cl-member query pocket-reader-queries :test ...) pocket-reader-queries (cons query pocket-reader-queries))) (pocket-reader--add-items items)) (cond ((eql pocket-reader-offset '0) (message "No items for query: %s" query)) (t (message "No more items for query: %s" query)))))))
  (let* ((add (car (cdr (plist-member --cl-rest-- ':add))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) '...) (if (cdr --cl-keys--) nil (error "Missing argument for %s" ...)) (setq --cl-keys-- (cdr ...))) ((car (cdr ...)) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:add)" (car --cl-keys--)))))) (progn (if (or current-prefix-arg add) nil (goto-char (point-min)) (custom-reevaluate-setting 'pocket-reader-show-count) (pocket-reader-unmark-all) (progn (setq pocket-reader-offset 0) (setq pocket-reader-queries nil) (setq pocket-reader-items (let (...) ht-temp)))) (let ((items (pocket-reader--get-items query))) (if items (progn (setq pocket-reader-queries (if ... pocket-reader-queries ...)) (pocket-reader--add-items items)) (cond ((eql pocket-reader-offset ...) (message "No items for query: %s" query)) (t (message "No more items for query: %s" query))))))))
  pocket-reader-search(":archive")
  funcall-interactively(pocket-reader-search ":archive")
  command-execute(pocket-reader-search)

@alphapapa
Copy link
Owner

It would seem that, somehow, pocket-reader--get-items is returning the number 1 rather than a list of items. I don't know how that could be possible. You'll probably have to step through that function with Edebug in order to understand what's happening.

@radixm46
Copy link

I am experiencing the same issue.
In my environment, when I retrieve the return value from pocket-lib-get, which is invoked in pocket-reader--get-items, I receive the following response:

((maxActions . 30) (cachetype . db) (status . 1) (error) (complete . 1) (since .
1727133572)
(list ;; list of articles
))

It seems that cl-third is applied to this, resulting in the value of items being 1.

@alphapapa
Copy link
Owner

@radixm46 Thanks, I see the problem now.

@radixm46 @christofdamian A fix is pushed to master. Please let me know if it works for you.

@alphapapa alphapapa added this to the 0.4 milestone Sep 24, 2024
@christofdamian
Copy link
Author

@alphapapa master works for me! Thank you!

@alphapapa
Copy link
Owner

Thanks.

@deen1
Copy link

deen1 commented Oct 5, 2024

I just started noticing this issue myself, I updated to the latest commit (7f55668) on master.

Unfortunately this now keeps giving me the error

pocket-reader--url-domain: Wrong type argument: arrayp, nil

@alphapapa
Copy link
Owner

@deen1 Please file a bug report.

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

4 participants