{"record":{"id":"f359ba78c704f917","repo":"jstedfast/MailKit","slug":"the-imap-server-does-not-support-the-partial-extension","errorCode":null,"errorMessage":"The IMAP server does not support the PARTIAL extension.","messagePattern":"The IMAP server does not support the PARTIAL extension\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"MailKit/Net/Imap/ImapFolderFetch.cs","lineNumber":1099,"sourceCode":"\n\t\tinternal static bool IsEmptyFetchRequest (IFetchRequest request)\n\t\t{\n\t\t\treturn request.Items == MessageSummaryItems.None && (request.Headers == null || (request.Headers.Count == 0 && !request.Headers.Exclude));\n\t\t}\n\n\t\tbool CheckCanFetch (IList<UniqueId> uids, IFetchRequest request)\n\t\t{\n\t\t\tif (uids == null)\n\t\t\t\tthrow new ArgumentNullException (nameof (uids));\n\n\t\t\tif (request == null)\n\t\t\t\tthrow new ArgumentNullException (nameof (request));\n\n\t\t\tif (request.ChangedSince.HasValue && !supportsModSeq)\n\t\t\t\tthrow new NotSupportedException (\"The ImapFolder does not support mod-sequences.\");\n\n\t\t\tif (request.PartialRange.HasValue && (Engine.Capabilities & ImapCapabilities.Partial) == 0)\n\t\t\t\tthrow new NotSupportedException (\"The IMAP server does not support the PARTIAL extension.\");\n\n\t\t\tCheckState (true, false);\n\n\t\t\treturn uids.Count > 0 && !IsEmptyFetchRequest (request);\n\t\t}\n\n\t\tstring CreateFetchCommand (IList<UniqueId> uids, IFetchRequest request, out bool previewText)\n\t\t{\n\t\t\tvar query = FormatSummaryItems (Engine, request, out previewText);\n\t\t\tvar command = new StringBuilder (\"UID FETCH %s \");\n\n\t\t\tcommand.Append (query);\n\n\t\t\tif (request.ChangedSince.HasValue || request.PartialRange.HasValue) {\n\t\t\t\tcommand.Append (\" (\");\n\n\t\t\t\tif (request.ChangedSince.HasValue) {\n\t\t\t\t\tcommand.AppendFormat (CultureInfo.InvariantCulture, \"CHANGEDSINCE {0}\", request.ChangedSince.Value);","sourceCodeStart":1081,"sourceCodeEnd":1117,"githubUrl":"https://github.com/jstedfast/MailKit/blob/9d3859a7855e3e17582c07fd01972b8e262bf176/MailKit/Net/Imap/ImapFolderFetch.cs#L1081-L1117","documentation":"CheckCanFetch(IList<UniqueId>, IFetchRequest) throws this NotSupportedException when request.PartialRange is set but the server's capabilities do not include ImapCapabilities.Partial. The PARTIAL fetch modifier (RFC 9051 / partial extensions) lets a fetch return only a byte/item range; MailKit refuses to build the command when the server cannot honor it.","triggerScenarios":"Calling Fetch(IList<UniqueId> uids, IFetchRequest request) or FetchAsync with request.PartialRange.HasValue on an IMAP server that does not advertise the PARTIAL capability.","commonSituations":"Using partial fetch to resume large BODY[] downloads or limit bandwith, aimed at a server without PARTIAL support; code written against newer servers (RFC 9051 IMAP4rev2) being run against older rev1 servers.","solutions":["Check client.Capabilities for ImapCapabilities.Partial before setting request.PartialRange","Remove PartialRange and fetch the full item instead","Emulate partial retrieval with BODY[]<start.length> section specifiers if the server supports them"],"exampleFix":"// before\nrequest.PartialRange = new PartialRange(0, 10240);\nvar summaries = folder.Fetch(uids, request);\n// after\nif ((client.Capabilities & ImapCapabilities.Partial) != 0) {\n    request.PartialRange = new PartialRange(0, 10240);\n} else {\n    request.PartialRange = null; // full fetch\n}\nvar summaries = folder.Fetch(uids, request);","handlingStrategy":"validation","validationCode":"if (request.PartialRange.HasValue && (client.Capabilities & ImapCapabilities.Partial) == 0)\n    request.PartialRange = null; // fetch full items instead\nvar summaries = folder.Fetch(uids, request);","typeGuard":null,"tryCatchPattern":"try {\n    summaries = folder.Fetch(uids, request);\n} catch (NotSupportedException) {\n    request.PartialRange = null;\n    summaries = folder.Fetch(uids, request);\n}","preventionTips":["Check client.Capabilities for ImapCapabilities.Partial before using PartialRange","Remember PARTIAL is an IMAP4rev2-era feature; older servers won't have it","Prefer BODY[]<offset.length> sectioning for partial downloads on legacy servers"],"tags":["imap","mailkit","not-supported","partial","fetch"],"backgroundTag":"feature-not-enabled","analyzedSha":"9d3859a7855e3e17582c07fd01972b8e262bf176","analyzedAt":"2026-09-15T15:46:11.592Z","contentChangedAt":"2026-09-15T15:46:11.592Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}