From 2dc91a853aebd65815b0aaa0066e7d4069673cd8 Mon Sep 17 00:00:00 2001
From: Adam Dinwoodie <adam@dinwoodie.org>
Date: Thu, 18 Jun 2026 09:33:00 +0100
Subject: [PATCH] Fix %-interpolation error

9c352d7 (Always pass an exception as first argument of ui.error,
2026-04-01) rearranged some of the arguments to `ui.error` in
`folder/IMAP.py`, but while it removed one of the %-interpolation
entries in the string to be interpolated, it didn't remove the argument
in the interpolation tuple.  This leads to errors like the below:

      File "offlineimap/folder/IMAP.py", line 863, in _fetch_from_imap
        "While fetching msg %r in folder %r."
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        " Query: %s Retrying (%d/%d)" % (
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
            e, uids, self.name, query,
            ~~~~~~~~~~~~~~~~~~~~~~~~~~
            retry_num - fails_left, retry_num))
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TypeError: %d format: a real number is required, not str

Remove the argument from the interpolation tuple that has now been
removed from the string, so the tuple parameters and string contents
match again.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
---
 offlineimap/folder/IMAP.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py
index c34d4c02..aca2808a 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -862,7 +862,7 @@ def _fetch_from_imap(self, uids, retry_num=1):
                                   exc_info()[2],
                                   "While fetching msg %r in folder %r."
                                   " Query: %s Retrying (%d/%d)" % (
-                                      e, uids, self.name, query,
+                                      uids, self.name, query,
                                       retry_num - fails_left, retry_num))
                     # Release dropped connection, and get a new one.
                     self.imapserver.releaseconnection(imapobj, True)
