jstedfast/MailKit · error · NotSupportedException

The IMAP server does not support the QRESYNC extension.

Error message

The IMAP server does not support the QRESYNC extension.

What it means

This NotSupportedException is thrown by QueueOpenCommand when opening a folder with QuickResync (QRESYNC) data while the server's CAPABILITIES do not advertise QRESYNC. The QRESYNC parameter on SELECT is only valid on servers supporting RFC 7162's QuickResync extension.

Solutions

  1. Check (client.Capabilities & ImapCapabilities.QuickResync) != 0 before requesting QuickResync; fall back to a plain Open.
  2. Fall back to UID-based incremental fetch: compare UidValidity and re-fetch via Search/GetMessages by UID instead of mod-seq resync.
  3. Enable QRESYNC support on the server (e.g. Dovecot: mail_plugins += imap_qresync / notify).
  4. Use client.Open with ImapEngineState-based plain folder open when capability is absent.

Example fix

// before
folder.Open(FolderAccess.ReadWrite, (uint)folder.HighestModSeq);

// after
if ((client.Capabilities & ImapCapabilities.QuickResync) != 0)
    folder.Open(FolderAccess.ReadWrite, (uint)folder.HighestModSeq);
else
    folder.Open(FolderAccess.ReadWrite);
Defensive patterns

Strategy: validation

Validate before calling

if ((client.Capabilities & ImapCapabilities.QuickResync) == 0) { folder.Open(FolderAccess.ReadWrite); } else { folder.Open(FolderAccess.ReadWrite, highestModSeq); }

Try / catch

try { folder.Open(access, highestModSeq); } catch (NotSupportedException) { folder.Open(access); }

Prevention

When it happens

Trigger: Calling ImapFolder.Open with a signature accepting highestModSeq/resynchronization data (or ImapClient enabling QRESYNC open options) when ImapCapabilities.QuickResync is not present in Engine.Capabilities.

Common situations: Developers who enabled CONDSTORE-style caching and pass a HighestModSeq on Open against older or minimal IMAP servers (e.g. some self-hosted/pop3-ish gateways) that lack QRESYNC; server capability changed after a migration.

Related errors


AI-assisted analysis of jstedfast/MailKit@9d3859a785 (2026-09-15). Data as JSON: /api/errors/45f8fe54bdd5ddd1. Report an issue: GitHub.

Appendix: source

Thrown at MailKit/Net/Imap/ImapFolder.cs:342

				return folder.OnUntaggedFetchResponseAsync (engine, index, ic.CancellationToken);

			folder.OnUntaggedFetchResponse (engine, index, ic.CancellationToken);

			return Task.CompletedTask;
		}

		ImapCommand QueueOpenCommand (FolderAccess access, uint uidValidity, ulong highestModSeq, IList<UniqueId> uids, CancellationToken cancellationToken)
		{
			if (access != FolderAccess.ReadOnly && access != FolderAccess.ReadWrite)
				throw new ArgumentOutOfRangeException (nameof (access));

			if (uids == null)
				throw new ArgumentNullException (nameof (uids));

			CheckState (false, false);

			if ((Engine.Capabilities & ImapCapabilities.QuickResync) == 0)
				throw new NotSupportedException ("The IMAP server does not support the QRESYNC extension.");

			if (!Supports (FolderFeature.QuickResync))
				throw new InvalidOperationException ("The QRESYNC extension has not been enabled.");

			string qresync;

			if ((Engine.Capabilities & ImapCapabilities.Annotate) != 0 && Engine.QuirksMode != ImapQuirksMode.iCloud)
				qresync = string.Format (CultureInfo.InvariantCulture, "(ANNOTATE QRESYNC ({0} {1}", uidValidity, highestModSeq);
			else
				qresync = string.Format (CultureInfo.InvariantCulture, "(QRESYNC ({0} {1}", uidValidity, highestModSeq);

			if (uids.Count > 0) {
				var set = UniqueIdSet.ToString (uids);
				qresync += " " + set;
			}

			qresync += "))";

View on GitHub (pinned to 9d3859a785)