Initiate by logging in to your Gmail account and click on the Settings (gear-symbol) to open the Gmail settings of your account. In the Gmail settings, select ‘Forwarding and POP/IMAP’ and locate IMAP and enable it. Under the Folder Size Limits option, check the box for ‘Do not limit the number of messages in an IMAP folder (default)’ to fix the Gmail IMAP error. Finally, save the changes. This should fix the issue for you.