{"record":{"id":"775d838ab8e628de","repo":"jstedfast/MailKit","slug":"the-imap-server-does-not-support-the-idle-extension","errorCode":null,"errorMessage":"The IMAP server does not support the IDLE extension.","messagePattern":"The IMAP server does not support the IDLE extension\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"MailKit/Net/Imap/ImapClient.cs","lineNumber":1922,"sourceCode":"\t\t{\n\t\t\tvar ic = QueueNoOpCommand (cancellationToken);\n\n\t\t\tengine.Run (ic);\n\n\t\t\tProcessNoOpResponse (ic);\n\t\t}\n\n\t\tvoid CheckCanIdle (CancellationToken doneToken)\n\t\t{\n\t\t\tif (!doneToken.CanBeCanceled)\n\t\t\t\tthrow new ArgumentException (\"The doneToken must be cancellable.\", nameof (doneToken));\n\n\t\t\tCheckDisposed ();\n\t\t\tCheckConnected ();\n\t\t\tCheckAuthenticated ();\n\n\t\t\tif ((engine.Capabilities & ImapCapabilities.Idle) == 0)\n\t\t\t\tthrow new NotSupportedException (\"The IMAP server does not support the IDLE extension.\");\n\n\t\t\tif (engine.State != ImapEngineState.Selected)\n\t\t\t\tthrow new InvalidOperationException (\"An ImapFolder has not been opened.\");\n\t\t}\n\n\t\tImapCommand QueueIdleCommand (ImapIdleContext context, CancellationToken cancellationToken)\n\t\t{\n\t\t\tvar ic = engine.QueueCommand (cancellationToken, null, \"IDLE\\r\\n\");\n\t\t\tic.ContinuationHandler = context.ContinuationHandler;\n\t\t\tic.UserData = context;\n\n\t\t\treturn ic;\n\t\t}\n\n\t\tstatic void ProcessIdleResponse (ImapCommand ic)\n\t\t{\n\t\t\tic.ThrowIfNotOk (\"IDLE\");\n\t\t}","sourceCodeStart":1904,"sourceCodeEnd":1940,"githubUrl":"https://github.com/jstedfast/MailKit/blob/9d3859a7855e3e17582c07fd01972b8e262bf176/MailKit/Net/Imap/ImapClient.cs#L1904-L1940","documentation":"Thrown as NotSupportedException when IdleAsync is called but the server's CAPABILITIES do not include the IDLE extension (RFC 2177). The client refuses to start an IDLE session the server cannot honor.","triggerScenarios":"Calling IdleAsync or idle-based push notification code against a server without IDLE capability; stale capabilities cache taken before login when the capability only appears after AUTHENTICATE.","commonSituations":"Legacy or minimal IMAP servers (some proxies, Exchange front-ends) lacking IDLE; connecting to a gateway that strips extensions; using idle fallback logic that assumes universal IDLE support.","solutions":["Check (client.Capabilities & ImapCapabilities.Idle) != 0 before idling and fall back to NOOP polling","Use client.Supports(ImapCapabilities.Idle) as a guard","Switch to a server that supports RFC 2177 IDLE","Re-query capabilities after authentication if they were cached too early"],"exampleFix":"// before\nawait client.IdleAsync(folder, doneToken);\n// after\nif ((folder.Capabilities & ImapCapabilities.Idle) != 0)\n    await client.IdleAsync(folder, doneToken);\nelse\n    await PollWithNoopAsync(folder, doneToken);","handlingStrategy":"fallback","validationCode":"bool canIdle = (client.Capabilities & ImapCapabilities.Idle) != 0;","typeGuard":null,"tryCatchPattern":"try { await folder.IdleAsync(doneToken); }\ncatch (NotSupportedException) { StartNoopPolling(folder, doneToken); }","preventionTips":["Inspect Capabilities after connect/login before using extension features","Implement NOOP polling fallback for servers without IDLE","Cache capabilities only after authentication (they can change)"],"tags":["imap","idle","capability","mailkit"],"backgroundTag":"operation-not-supported","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"}