Net::IMAP throws .[] for nil class on search

require ‘net/imap’ imap =‘’, 993, true)

imap.login(‘login’, ‘password’)‘INBOX’)

=> #<struct Net::IMAP::TaggedResponse tag=“RUBY0010”, name=“OK”, data=#<struct Net::IMAP::ResponseText code=#<struct Net::IMAP::ResponseCode name=“READ-WRITE”, data=nil>, text=" SELECT completed">, raw_data=“RUBY0010 OK [READ-WRITE] SELECT completed\r\n”>[‘ALL’])

NoMethodError: You have a nil object when you didn’t expect it!

You might have expected an instance of ActiveRecord::Base.

The error occurred while evaluating nil.

This error throws only with IMAP server

How could Net::IMAP throws ActiveRecord::Base exception?