BAD Error in IMAP command APPEND: Missing ')'
Categories
(MailNews Core :: Networking: IMAP, defect)
Tracking
(Not tracked)
People
(Reporter: christin.stornowski, Unassigned)
References
Details
Steps to reproduce:
I was trying to save an email as a draft in thunderbird. I'm using dovecot docker image from dockerhub.
Actual results:
1748068899.516623 19 COMPRESS DEFLATE
1748068899.512341 18 OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE REPLACE SNIPPET=FUZZY PREVIEW=FUZZY PREVIEW SPECIAL-USE STATUS=SIZE SAVEDATE COMPRESS=DEFLATE INPROGRESS NOTIFY LITERAL+ UTF8=ACCEPT FILTER=SIEVE] Logged in
1748068899.516726 19 OK Begin compression (0.001 + 0.000 secs).
1748068899.523433 20 ID ("name" "Thunderbird" "version" "128.10.2")
1748068899.526890 21 ENABLE UTF8=ACCEPT
1748068899.529568 22 select "Drafts"
1748068899.543016 23 append "Drafts" (\Draft) UTF8 (~{2876+}
1748068899.544886 Message-ID: <xxx>
1748068899.544886 Date: Sat, 24 May 2025 08:41:39 +0200
1748068899.544886 MIME-Version: 1.0
1748068899.544886 User-Agent: Mozilla Thunderbird
1748068899.544886 Content-Language: de-DE, en-GB
1748068899.544886 To: xxx
1748068899.544886 From: xxx
1748068899.544886 Subject: xxx
1748068899.544886 Autocrypt: addr=xxx; keydata=
1748068899.544886 xxx
1748068899.544886 X-Enigmail-Draft-Status: N11222
1748068899.544886 X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0;
1748068899.544886 attachmentreminder=0; deliveryformat=0
1748068899.544886 X-Identity-Key: id1
1748068899.544886 Fcc: imap://xxx/Sent
1748068899.544886 Content-Type: multipart/encrypted;
1748068899.544886 protocol="application/pgp-encrypted";
1748068899.544886 boundary="------------xxx"
1748068899.544886
1748068899.544886 This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)
1748068899.544886 --------------xxx
1748068899.544886 Content-Type: application/pgp-encrypted
1748068899.544886 Content-Description: PGP/MIME version identification
1748068899.544886
1748068899.544886 Version: 1
1748068899.544886
1748068899.544886 --------------xxx
1748068899.544886 Content-Type: application/octet-stream; name="encrypted.asc"
1748068899.544886 Content-Description: OpenPGP encrypted message
1748068899.544886 Content-Disposition: inline; filename="encrypted.asc"
1748068899.544886
1748068899.544886 -----BEGIN PGP MESSAGE-----
1748068899.544886
1748068899.544886 xxx
1748068899.544886 -----END PGP MESSAGE-----
1748068899.544886
1748068899.544886 --------------xxx--
1748068899.544886 )
1748068899.523551 * ID ("name" "Dovecot")
1748068899.523598 20 OK ID completed (0.001 + 0.000 secs).
1748068899.526960 * ENABLED UTF8=ACCEPT
1748068899.526985 21 OK Enabled (0.001 + 0.000 secs).
1748068899.530197 * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
1748068899.530224 * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft *)] Flags permitted.
1748068899.530243 * 0 EXISTS
1748068899.530260 * 0 RECENT
1748068899.530278 * OK [UIDVALIDITY 1716789499] UIDs valid
1748068899.530295 * OK [UIDNEXT 5] Predicted next UID
1748068899.530327 * OK [HIGHESTMODSEQ 13] Highest
1748068899.530355 22 OK [READ-WRITE] Select completed (0.001 + 0.000 secs).
1748068899.544993 23 BAD Error in IMAP command APPEND: Missing ')' (0.001 + 0.002 + 0.001 secs).
1748068899.545152 * BAD Error in IMAP tag: Invalid tag (0.001 + 0.000 secs).
1748068899.545174 Date: BAD Error in IMAP command SAT,: Unknown command (0.001 + 0.000 secs).
1748068899.545221 MIME-Version: BAD Error in IMAP command 1.0: Unknown command (0.001 + 0.000 secs).
1748068899.545269 User-Agent: BAD Error in IMAP command MOZILLA: Unknown command (0.001 + 0.000 secs).
1748068899.545308 Content-Language: BAD Error in IMAP command DE-DE,: Unknown command (0.001 + 0.000 secs).
1748068899.545347 To: BAD Error in IMAP command xxx: Unknown command (0.001 + 0.000 secs).
1748068899.545409 From: BAD Error in IMAP command xxx: Unknown command (0.001 + 0.000 secs).
1748068899.545470 Subject: BAD Error in IMAP command ASD: Unknown command (0.001 + 0.000 secs).
1748068899.545535 Autocrypt: BAD Error in IMAP command ADDR=xxx;: Unknown command (0.001 + 0.000 secs).
1748068899.545577 * BAD Error in IMAP tag: Invalid tag (0.001 + 0.000 secs).
1748068899.545594 * BAD Error in IMAP tag: Invalid tag (0.001 + 0.000 secs).
1748068899.545610 * BAD Error in IMAP tag: Invalid tag (0.000 + 0.000 secs).
1748068899.545627 * BAD Error in IMAP tag: Invalid tag (0.001 + 0.000 secs).
1748068899.545642 * BAD Error in IMAP tag: Invalid tag (0.001 + 0.000 secs).
1748068899.545663 * BAD Error in IMAP tag: Invalid tag (0.001 + 0.000 secs).
1748068899.545678 * BAD Error in IMAP tag: Invalid tag (0.001 + 0.000 secs).
1748068899.545694 * BAD Error in IMAP tag: Invalid tag (0.001 + 0.000 secs).
1748068899.545710 X-Enigmail-Draft-Status: BAD Error in IMAP command N11222: Unknown command (0.001 + 0.000 secs).
1748068899.545751 X-Mozilla-Draft-Info: BAD Error in IMAP command INTERNAL/DRAFT;: Unknown command (0.001 + 0.000 secs).
1748068899.545768 * BYE Too many invalid IMAP commands.
Expected results:
Draft should be saved and imap append should be append "Drafts" (\Draft) UTF8 ({2876+}) and not append "Drafts" (\Draft) UTF8 ({2876+}
Comment 1•1 year ago
|
||
Something went wrong in the middle: https://searchfox.org/comm-central/rev/f9aadaa9c857b33bf688107d3c7c85f04c461363/mailnews/imap/src/nsImapProtocol.cpp#6233-6295
Comment 2•1 year ago
|
||
(In reply to Chris from comment #0)
1748068899.526890 21 ENABLE UTF8=ACCEPT
1748068899.529568 22 select "Drafts"
1748068899.543016 23 append "Drafts" (\Draft) UTF8 (~{2876+}
1748068899.544886 Message-ID: <xxx>
[...]
1748068899.544886 --------------xxx--
1748068899.544886 )
As you can see in the line above, we do send the bracket.
1748068899.544993 23 BAD Error in IMAP command APPEND: Missing ')' (0.001 + 0.002 + 0.001 secs).
But obviously the server doesn't find this bracket.
So either the length of the data {2876+} is not correct, or it is a server error.
Draft should be saved and imap append should be append "Drafts" (\Draft) UTF8 (
{2876+}) and not append "Drafts" (\Draft) UTF8 ({2876+}
That is not quite right.
Comment 3•1 year ago
|
||
Comment 4•1 year ago
|
||
I tested saving (actaully imap APPENDing) some big and complex messages into Drafts using dovecot 2.3.21.1 running on fedora 42 and don't see a problem with that.
Reporter Chris,
If you don't find anything from dovecot, maybe a IMAP:4 log would show something. See https://wiki.mozilla.org/MailNews:Logging
Side note: with current (self-built) daily 140.0a1, when trying to open huge PDF attachments in my test messages, I sometimes see a crash here:
Hit MOZ_CRASH(nsWeakReference not thread-safe) at /home/gene/mozilla2/xpcom/base/nsISupportsImpl.cpp:43
Also, I can only see the first few pages of the PDFs and the remaining pages remain blank with just progress "spinner" spinning even when there is no crash. Also, compared to older "daily" TB versions I've been running over several years, the more recent ones seem a LOT slower doing most things.
You should test this with dovecot 2.4. Fairmail, another email client, on Android don't has this issue.
Comment 6•1 year ago
|
||
Ok, I misread the comment 3 link. Thought you were using 2.3 but are using dovecot 2.4.
Do you see the problem for all messages saved to Drafts or just to some messages?
If you send a messages, does it get saved OK to "Sent Messages" folder? It's the same imap APPEND command that occurs as when you save a draft.
Anyhow, if you still think it's a TB problem, please provide an IMAP:4 log as described here: https://wiki.mozilla.org/MailNews:Logging
Comment 7•1 year ago
|
||
Apparently dovecot 2.4 is just now supporting UTF8=ACCEPT imap capability. It is not mentioned in my 2.3 /etc/dovecot files and don't see it in CAPABILITY response for 2.3 dovecot. So there must be something wrong with how TB is handling this (or a problem in the dovecot server). I'll compare it to gmail which does support UTF8 and appends do it work OK in TB with gmail.
For now, a possible work-around is to disable imap UTF8=ACCEPT support in TB by setting pref mail.server.default.allow_utf8_accept to false.
You should test this with dovecot 2.4. Fairmail, another email client, on Android don't has this issue.
Don't have Fairmail or a way to see what Android is doing. Don't know but maybe Fairmail doesn't support imap UTF8=ACCEPT is why it works (assuming the problem is in dovecot 2.4, which may be wrong).
(In reply to gene smith from comment #6)
Ok, I misread the comment 3 link. Thought you were using 2.3 but are using dovecot 2.4.
Do you see the problem for all messages saved to Drafts or just to some messages?
If you send a messages, does it get saved OK to "Sent Messages" folder? It's the same imap APPEND command that occurs as when you save a draft.
Anyhow, if you still think it's a TB problem, please provide an IMAP:4 log as described here: https://wiki.mozilla.org/MailNews:Logging
I see this problem for all messages that should be saved. Saving for drafts or save after sending message didn't make any difference.
(In reply to gene smith from comment #7)
Apparently dovecot 2.4 is just now supporting UTF8=ACCEPT imap capability. It is not mentioned in my 2.3 /etc/dovecot files and don't see it in CAPABILITY response for 2.3 dovecot. So there must be something wrong with how TB is handling this (or a problem in the dovecot server). I'll compare it to gmail which does support UTF8 and appends do it work OK in TB with gmail.
For now, a possible work-around is to disable imap UTF8=ACCEPT support in TB by setting pref
mail.server.default.allow_utf8_acceptto false.You should test this with dovecot 2.4. Fairmail, another email client, on Android don't has this issue.
Don't have Fairmail or a way to see what Android is doing. Don't know but maybe Fairmail doesn't support imap UTF8=ACCEPT is why it works (assuming the problem is in dovecot 2.4, which may be wrong).
This is working in Thunderbird. :-)
Comment 10•1 year ago
•
|
||
This is working in Thunderbird. :-)
Ok, good to know that disabling UTF8=ACCEPT fixes it. However, looking closer, a better work-around might be to set mail.imap.use_literal_plus to false. The other two imap servers I have that work OK with UTF8=ACCEPT enabled (courier and gmail) don't support capability LITERAL+ so there is no "+" added to the length parameter of the APPEND command and TB waits for a "+" response from the server before sending the full message to append. So please try disabling LITERAL+ and re-enabling UTF8=ACCEPT and see if that works too.
I don't see anything wrong with what TB is doing. So with just LITERAL+ disabled you should see in the dovecot logs that the first line should change from
<tag> append "Drafts" (\Draft) UTF8 (~{2876+} // using default UTF=ACCEPT and LITERAL+ setting and will fail
to this
<tag> append "Drafts" (\Draft) UTF8 (~{2876} // using just LITERAL+ disabled and should work
So if you save to Drafts the same message the lengths should be the same in both cases and I'm thinking the 2nd one will work.
Comment 11•1 year ago
•
|
||
Based on what I can tell, I don't think the IMAP:4 log I requested above will be helpful at this time.
| Reporter | ||
Comment 12•1 year ago
|
||
(In reply to gene smith from comment #10)
This is working in Thunderbird. :-)
Ok, good to know that disabling UTF8=ACCEPT fixes it. However, looking closer, a better work-around might be to set
mail.imap.use_literal_plusto false. The other two imap servers I have that work OK with UTF8=ACCEPT enabled (courier and gmail) don't support capability LITERAL+ so there is no "+" added to the length parameter of the APPEND command and TB waits for a "+" response from the server before sending the full message to append. So please try disabling LITERAL+ and re-enabling UTF8=ACCEPT and see if that works too.
I don't see anything wrong with what TB is doing. So with just LITERAL+ disabled you should see in the dovecot logs that the first line should change from
<tag> append "Drafts" (\Draft) UTF8 (~{2876+}// using default UTF=ACCEPT and LITERAL+ setting and will fail
to this
<tag> append "Drafts" (\Draft) UTF8 (~{2876}// using just LITERAL+ disabled and should work
So if you save to Drafts the same message the lengths should be the same in both cases and I'm thinking the 2nd one will work.
This is also working. :-)
Comment 13•1 year ago
|
||
Closing as INVALID.
It was a dovecot bug. See near bottom here: https://dovecot.org/mailman3/archives/list/dovecot@dovecot.org/thread/ISDELHRRPVV3PY4SPHYBIVJMTSG5AWAF/
Description
•