Skip to content

Sporadic Net::IMAP::ResponseParseError: unexpected QUOTED (expected "]") on Outlook365 #597

@hoffi

Description

@hoffi

Sometimes i get random ResponseParseError's when working with Outlook365 mailboxes.
I activated debug logging and found the following log message when the error occurred:

S: RUBY0001 OK [Error="Microsoft.Exchange.Data.Storage.WrongServerException:Cross Server access is not allowed for mailbox xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" AuthResultFromPopImapEnd=0 Proxy=XXXXXXXXXXXXX.EURXXXX.PROD.OUTLOOK.COM:1993:SSL MailboxBE=XXXXXXXXXXXXX.EURXXXX.PROD.OUTLOOK.COM Service=Imap4] AUTHENTICATE completed.
Net::IMAP::ResponseParser parse_error: unexpected QUOTED (expected "]")
  tokenized : "RUBY0001 OK [Error=\"Microsoft.Exchange.Data.Storage.WrongServerException:Cross Server access is not allowed for mailbox xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"" 
  remaining : " AuthResultFromPopImapEnd=0 Proxy=XXXXXXXXXXXXX.EURXXXX.PROD.OUTLOOK.COM:1993:SSL MailboxBE=XXXXXXXXXXXXX.EURXXXX.PROD.OUTLOOK.COM Service=Imap4] AUTHENTICATE completed.\r\n" 
  @lex_state: EXPR_BEG
  @pos      : 157
  @token    : QUOTED: "Microsoft.Exchange.Data.Storage.WrongServerException:Cross Server access is not allowed for mailbox xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 
  caller[ 0]: rbra                           (parser_utils:54)
  caller[ 1]: resp_text                      (response_parser:1887)
  caller[ 2]: resp_cond_state                (response_parser:815)
  caller[ 3]: response_tagged                (response_parser:804)
  caller[ 4]: response                       (response_parser:683)
  caller[ 5]: parse                          (response_parser:40)
  caller[ 6]: get_response                   (imap:3494)
  caller[ 7]: receive_responses              (imap:3396)
  caller[ 8]: start_receiver_thread          (imap:3373)

Currently i use net-imap 0.5.12. But i have tested with the latest version 0.6.2 and parsing also fails here:

Net::IMAP::ResponseParser.new.parse 'RUBY0001 OK [Error="Microsoft.Exchange.Data.Storage.WrongServerException:Cross Server access is not allowed for mailbox xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" AuthResultFromPopImapEnd=0 Proxy=XXXXXXXXXXXXX.EURXXXX.PROD.OUTLOOK.COM:1993:SSL MailboxBE=XXXXXXXXXXXXX.EURXXXX.PROD.OUTLOOK.COM Service=Imap4] AUTHENTICATE completed.'
'Net::IMAP::ResponseParser::ParserUtils#parse_error': unexpected QUOTED (expected "]") (Net::IMAP::ResponseParseError)

The error looks like something failed internally on exchange.
However the parsing should not fail here, as the IMAP spec seems to allow this as far as i understand it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions