zevlg/telega.el

Telega stuck loading old history, `error: (wrong-type-argument stringp nil)`

Icy-Thought opened this issue ยท 5 comments

Telega Setup

OS: NixOS 24.05 (Uakari)
Emacs: GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.39, cairo version 1.18.0)
Features: svg webp ffmpeg
Telega: telega v0.8.213 (TDLib v1.8.24-GITDIR-) (telega-server v0.8.2)
MELPA: 20231116.1

Current Behavior

Telega is unable to load previous message history. And if loaded through the app, the messages I send would not appear in the message history.

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  intern(nil)
  #f(compiled-function (reaction) #<bytecode 0x117c669d6625f728>)(:@type)
  mapcar(#f(compiled-function (reaction) #<bytecode 0x117c669d6625f728>) (:@type "messageReactions" :reactions [(:@type "messageReaction" :type (:@type "reactionTypeEmoji" :emoji #("  " 0 2 (telega-emoji-p t telega-display " "))) :total_count 1 :is_chosen nil :recent_sender_ids [(:@type "messageSenderUser" :user_id XXXXXXXXX)])] :are_tags nil))
  telega-custom-emoji--ids-for-msg((:@type "message" :id XXXXXXXXXXXX :sender_id (:@type "messageSenderUser" :user_id XXXXXXXXX) :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t :can_be_deleted_only_for_self nil :can_be_deleted_for_all_users nil :can_get_added_reactions t :can_get_statistics nil :can_get_message_thread t :can_get_read_date nil :can_get_viewers nil :can_get_media_timestamp_links t :can_report_reactions t :has_timestamped_media nil :is_channel_post nil :is_topic_message nil :contains_unread_mention nil :date 1707442132 :edit_date 0 ...))
  telega-msg--custom-emojis-fetch((:@type "message" :id XXXXXXXXXXXX :sender_id (:@type "messageSenderUser" :user_id XXXXXXXXX) :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t :can_be_deleted_only_for_self nil :can_be_deleted_for_all_users nil :can_get_added_reactions t :can_get_statistics nil :can_get_message_thread t :can_get_read_date nil :can_get_viewers nil :can_get_media_timestamp_links t :can_report_reactions t :has_timestamped_media nil :is_channel_post nil :is_topic_message nil :contains_unread_mention nil :date 1707442132 :edit_date 0 ...))
  run-hook-with-args(telega-msg--custom-emojis-fetch (:@type "message" :id XXXXXXXXXXXX :sender_id (:@type "messageSenderUser" :user_id XXXXXXXXXXXX) :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t :can_be_deleted_only_for_self nil :can_be_deleted_for_all_users nil :can_get_added_reactions t :can_get_statistics nil :can_get_message_thread t :can_get_read_date nil :can_get_viewers nil :can_get_media_timestamp_links t :can_report_reactions t :has_timestamped_media nil :is_channel_post nil :is_topic_message nil :contains_unread_mention nil :date 1707442132 :edit_date 0 ...))
  #f(compiled-function (msg) #<bytecode 0x1bd381bc39497ef2>)((:@type "message" :id XXXXXXXXXXXX :sender_id (:@type "messageSenderUser" :user_id XXXXXXXXXXXX) :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t :can_be_deleted_only_for_self nil :can_be_deleted_for_all_users nil :can_get_added_reactions t :can_get_statistics nil :can_get_message_thread t :can_get_read_date nil :can_get_viewers nil :can_get_media_timestamp_links t :can_report_reactions t :has_timestamped_media nil :is_channel_post nil :is_topic_message nil :contains_unread_mention nil :date 1707442132 :edit_date 0 ...))
  mapc(#f(compiled-function (msg) #<bytecode 0x1bd381bc39497ef2>) [(:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) ...])
  seq-do(#f(compiled-function (msg) #<bytecode 0x1bd381bc39497ef2>) [(:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -1001302507873 :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) ...])
  telega-chatbuf--insert-messages([(:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id 801437122560 :sender_id ... :chat_id -XXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) (:@type "message" :id XXXXXXXXXXXX :sender_id ... :chat_id -XXXXXXXXXXXXX :is_outgoing nil :is_pinned nil :can_be_edited nil :can_be_forwarded t :can_be_replied_in_another_chat t :can_be_saved t ...) ...] prepend)
  #f(compiled-function (history) #<bytecode -0x193539e7f0b87772>)((:@type "messages" :total_count 30 :messages [... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...] :@extra 14))
  telega-server--dispatch-cmd("event" (:@type "messages" :total_count 30 :messages [... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...] :@extra 14))
  apply(telega-server--dispatch-cmd ("event" (:@type "messages" :total_count 30 :messages ... :@extra 14)))
  telega-server--parse-commands()
  telega-server--filter(#<process telega-server> "event 40148\n(:@type \"messages\" :total_count 30 :me...")

And in the end of the chat buffer there should be a loading message.
Selection 2024-02-14 21:01:15

Steps to Reproduce

1.Install Telega from the NixOS unstable branch. (should say v0.8.3)
2.Add the following elisp code to your config:

Note

  1. Reducing the config to only contain the basic needs also breaks it for me.
  2. Re-installing Telega + removing ~/.config/emacs/var/telega directory (no-littering) does not fix the issue.
(use-package telega
  :ensure nil ;; <-^ fetched from Nixpkgs
  :commands (telega)
  :hook (telega-chat-mode . visual-line-mode)
  :custom
  (telega-directory (no-littering-expand-var-file-name "telega/"))
  (telega-chat-bidi-display-reordering t)
  (telega-notifications-mode t)
  (telega-emoji-use-images nil) ;; recent libsvg issue..
  :config
  (when (featurep 'cape)
    (add-hook 'telega-chat-mode-hook
              (lambda ()
                (add-hook 'completion-at-point-functions #'cape-dict nil t)
                (add-hook 'completion-at-point-functions #'cape-emoji nil t)))))
  1. Setup telegram and enter a random chat. You should notice the error.

Possible Solution

Apparently the issue is non-existent in the unstable version of Telega. But due to how the unstable version works, I would rather fix the issue in the stable version. Somehow, I am not able to have the files all places inside telega-directory nor view profile pictures in emacsclient service.

Your telega version (v0.8.213) is not compatible with installed TDLib (v1.8.24), please update your telega to 0.8.240+ version

Now that makes sense! I guess I, or someone else, need to rework the nix implementation.

Now that makes sense! I guess I, or someone else, need to rework the nix implementation.

You probably just grabbed an outdated version from nixpkgs. Try getting telega from emacs-overlay instead.

I did manage to fix it by grabbing the latest version from the emacs-overlay, but forgot to mention it here. Nonetheless, appreciate the suggestion!