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

require ‘net/imap’
imap = Net::IMAP.new(‘imap.yandex.ru’, 993, true)

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

imap.select(‘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”>

imap.search([‘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 yandex.ru IMAP server

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