bug#81514: 32.0.50; Eglot messages progress reporter shows errors

Stéphane Marks <[email protected]> Wed, 29 Jul 2026 21:33:10 +0200
Newsgroups gmane.emacs.bugs
Message-ID <CAN+1Hbo4kdQ_=B=6-H2ggDRqcK=VNfSfM+Ley7J7yZjZx4+LjA@mail.gmail.com>
On Wed, Jul 29, 2026 at 2:47 PM Stéphane Marks <[email protected]> wrote:

> On Wed, Jul 29, 2026 at 11:17 AM Jacek Świerk <[email protected]>
> wrote:
>
>> I can reproduce it with clangd on the following C++ repository:
>> https://github.com/rui314/mold. It doesn't happen every time but often
>> enough:
>>
>> Debugger entered--Lisp error: (wrong-type-argument sequencep 100)
>>   ((20 . [1785337541.907988 nil nil "[eglot] mold
>> backgroundIndexProgress: indexing..." 1 0.2 nil nil]) 20 100)
>>   progress-reporter-do-update((20 . [1785337541.907988 nil nil "[eglot]
>> mold backgroundIndexProgress: indexing..." 1 0.2 nil nil]) 100 nil)
>>   eglot--reporter-update((20 . [1785337541.907988 nil nil "[eglot] mold
>> backgroundIndexProgress: indexing..." 1 0.2 nil nil]) 100 nil)
>>   #f(compiled-function (arg1 arg2 arg3 arg4 &rest rest) #<bytecode
>> 0xa1216d65848076a>)(#<eglot-lsp-server 1022b7360904>
>> "backgroundIndexProgress" 100 nil)
>>   #f(compiled-function (arg1 arg2 &rest rest) "Handle $/progress
>> notification identified by TOKEN from SERVER." #<bytecode
>> -0xf68beacb9f43862>)(#<eglot-lsp-server 1022b7360904> $/progress :token
>> "backgroundIndexProgress" :value (:kind "end"))
>>   apply(#f(compiled-function (arg1 arg2 &rest rest) "Handle $/progress
>> notification identified by TOKEN from SERVER." #<bytecode
>> -0xf68beacb9f43862>) #<eglot-lsp-server 1022b7360904> $/progress (:token
>> "backgroundIndexProgress" :value (:kind "end")))
>>   eglot-handle-notification(#<eglot-lsp-server 1022b7360904> $/progress
>> :token "backgroundIndexProgress" :value (:kind "end"))
>>   apply(eglot-handle-notification #<eglot-lsp-server 1022b7360904>
>> $/progress (:token "backgroundIndexProgress" :value (:kind "end")))
>>   #f(compiled-function (server method params) #<bytecode
>> 0x1f1b657efb0838aa>)(#<eglot-lsp-server 1022b7360904> $/progress (:token
>> "backgroundIndexProgress" :value (:kind "end")))
>>   jsonrpc-connection-receive(#<eglot-lsp-server 1022b7360904> (:jsonrpc
>> "2.0" :method "$/progress" :params (:token "backgroundIndexProgress" :value
>> (:kind "end"))))
>>   #f(compiled-function (conn msg) #<bytecode
>> 0x4e6153735258fd3>)(#<eglot-lsp-server 1022b7360904> (:jsonrpc "2.0"
>> :method "$/progress" :params (:token "backgroundIndexProgress" :value
>> (:kind "end"))))
>>   apply(#f(compiled-function (conn msg) #<bytecode 0x4e6153735258fd3>)
>> (#<eglot-lsp-server 1022b7360904> (:jsonrpc "2.0" :method "$/progress"
>> :params (:token "backgroundIndexProgress" :value (:kind "end")))))
>>   timer-event-handler([t 27242 5829 902968 nil #f(compiled-function (conn
>> msg) #<bytecode 0x4e6153735258fd3>) (#<eglot-lsp-server 1022b7360904>
>> (:jsonrpc "2.0" :method "$/progress" :params (:token
>> "backgroundIndexProgress" :value (:kind "end")))) nil 894000 nil])
>>
>> The LSP message that causes it looks like this from the
>> (eglot-events-buffer):
>> <-- $/progress
>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"end"}}}
>>
>> Based on my understanding of Eglot code, Eglot creates a non-numeric
>> progress
>> reporter because MIN-VALUE and MAX-VALUE arguments are not provided.
>> However, it
>> looks like Eglot updates the created progress reporter as it were numeric:
>> (eglot--reporter-update pr pcnt msg)
>>
>> For the {"kind": "end"} notification, pcnt is set to 100 and msg is nil.
>> After
>> commit b6849229003, the pulsing reporter forwards (or update-text value)
>> as
>> UPDATE-TEXT. That evaluates to 100. Then progress-reporter-echo-area tries
>> (concat (if update-text " " "") update-text) which triggers the shown
>> error.
>>
> I was able to reproduce the issue without eglot and will take a look.
>
> Coincidentally, and independent of the issue, eglot seems to want a
> numeric reporter but instead creates a non-numeric reporter.  eglot-handle-notification
> method seems to also be missing the call to progress-reporter-done that
> would clear any stateful reporters it's created such as those in
> system-taskbar for which a relevant change was made in Tramp recently.  I
> can take a stab at those.
>

Here's a patch for progress-reporter.  I can look into eglot separately if
agreed.

-Stéphane
0001-Fix-progress-reporter-echo-area-update-text-bug-8151.patch (application/octet-stream, 960 B)
From bb8a69597a1c52838926f1854b36b4d63455a956 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Marks?= <[email protected]>
Date: Wed, 29 Jul 2026 15:30:45 -0400
Subject: [PATCH] Fix progress-reporter-echo-area update-text (bug#81514)

* lisp/subr.el (progress-reporter-echo-area): Format UPDATE-TEXT
as a string.
---
 lisp/subr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index a9924445ada..b465738f106 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -7240,7 +7240,7 @@ progress-reporter-echo-area
     (unless (and (eq (progress-reporter-context reporter) 'async)
                  (current-message)
                  (not (string-prefix-p text (current-message))))
-      (setq update-text (concat (if update-text " " "") update-text))
+      (setq update-text (if update-text (format " %s" update-text) ""))
       (pcase state
         ((pred floatp)
          (if (plusp state)
-- 
2.54.0