Fix UID Out-of-Range Errors in Office 365 IMAP Migration
Question details
The user needs to troubleshoot UID errors that interrupt an IMAP migration to Office 365.

- Product
- Microsoft 365 Exchange Online IMAP migration
- Device & OS
- not provided
- Scenario
- Migrating mailboxes from a source IMAP server to Exchange Online.
- Observed behavior
- The migration fails with errors such as MigrationMRSPermanentException, UidNotPresentInResponseException, or UidOutOfRangePermanentException.
Obtain the source IMAP server's fully qualified domain name, port, and security settings from the email provider. Ensure you have the permissions needed to connect to Exchange Online PowerShell and view the migration batch.
Test the source IMAP server connection
Use Exchange Online PowerShell to check whether the migration service can reach the source server with the specified settings.
Check the source email provider's IMAP settings for the server name, port, and security type. Use the settings supplied by the provider rather than assuming a particular port or security combination.
Open PowerShell, load the Exchange Online PowerShell module, and run Connect-ExchangeOnline. Sign in with an account authorized to manage the migration.
Run Test-MigrationServerAvailability -IMAP -RemoteServer <IMAP-server-FQDN> -Port <port> -Security <None, Ssl, or Tls>, replacing the placeholders with the provider's settings. For example, use port 993 with Ssl only if the provider specifies that combination.
Review the command output. If the test fails, check the server name, port, security settings, and any firewall restrictions with the source email provider, then run the test again.

Investigate invalid UID responses from the source mailbox
Use this approach when connectivity checks pass but a mailbox continues to report UID errors.
Use WPS Office to Organize Migration Records
WPS Office is a free, lightweight, easy-to-use Microsoft Office alternative with a familiar interface. Open compatible Office files to review migration records and move between office suites without changing your existing file formats. WPS Office does not fix or perform Exchange Online IMAP migrations.

Frequently Asked Questions
What does a UID out-of-range error mean during IMAP migration?
It indicates a problem involving message identifiers in the source IMAP response. Check server connectivity and settings first, then ask the source provider to investigate the affected mailbox if the error persists.
How do I test the IMAP server from Exchange Online?
Connect to Exchange Online PowerShell and run Test-MigrationServerAvailability with the -IMAP, -RemoteServer, -Port, and -Security parameters using the source provider's settings.
Which IMAP port and security setting should I use?
Use the combination specified by the source email provider. Port 993 commonly uses SSL, but the provider's configuration is the authoritative source for your server.
What should I do if the server test succeeds but migration still fails?
Open the migration batch in the Exchange admin center, record the affected mailbox and error details, and ask the source provider to check its IMAP responses and logs.




