Mail: Could not load message.

Created on 4 Sep 2020  路  16Comments  路  Source: nextcloud/mail

Steps to reproduce

  1. Disable TLS via 'app.mail.verify-tls-peer' => false, in config.php
  2. Create an account in Mail app
  3. Select any message

Expected behaviour

Display mail message

Actual behaviour

"Could not load message"

Error

OCA\Mail\Exception\ServiceException: Could not load message
  at OCA\Mail\Service\MailManager::getMessage
     /var/www/nextcloud/apps/mail/lib/Controller/MessagesController.php, line 219
  at OCA\Mail\Controller\MessagesController::getBody
     /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php, line 170
  at OC\AppFramework\Http\Dispatcher::executeController
     /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php, line 100
  at OC\AppFramework\Http\Dispatcher::dispatch
     /var/www/nextcloud/lib/private/AppFramework/App.php, line 137
  at OC\AppFramework\App::main
     /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php, line 47
  at OC\AppFramework\Routing\RouteActionHandler::__invoke
  at call_user_func
     /var/www/nextcloud/lib/private/Route/Router.php, line 297
  at OC\Route\Router::match
     /var/www/nextcloud/lib/base.php, line 1007
  at OC::handleRequest
     /var/www/nextcloud/index.php, line 37

0. to triage bug

Most helpful comment

@paulcalabro, I have been occupied with other projects, so I never did configure the bridge again after the update like @ChristophWurst suggested. I will try to find some time to test it again since you're having the same issue.

All 16 comments

Again, check the logs for details

Again? No one has previously suggested to me to check any logs, let alone which logs would be most helpful...
Here are some that seem most relevant.

Admin logging page

Warning | mail | not enough messages to train a classifier

Continued from previous comment:
Caused by OCP\AppFramework\Db\DoesNotExistException: Mail body for this mail(2) could not be loaded

    /var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php - line 521:

    OCA\Mail\Model\IMAPMessage->loadBodyData(Horde_Mime_Part { parent: null}, 1)

    /var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php - line 394:

    OCA\Mail\Model\IMAPMessage->handleHtmlMessage(Horde_Mime_Part { parent: null}, 1)

    /var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php - line 343:

    OCA\Mail\Model\IMAPMessage->getPart(Horde_Mime_Part { parent: null}, 1)

    /var/www/nextcloud/apps/mail/lib/Model/IMAPMessage.php - line 94:

    OCA\Mail\Model\IMAPMessage->loadMessageBodies()

    /var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php - line 211:

    OCA\Mail\Model\IMAPMessage->__construct(Horde_Imap_C ... e}, "INBOX", 2, null, true)

    <<closure>>

    OCA\Mail\IMAP\MessageMapper->OCA\Mail\IMAP\{closure}("*** sensiti ... *")

    /var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php - line 225:

    array_map(Closure {}, [ "*** sensi ... "])

    /var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php - line 63:

    OCA\Mail\IMAP\MessageMapper->findByIds(Horde_Imap_C ... e}, "INBOX", [ 2], true)

    /var/www/nextcloud/apps/mail/lib/Service/MailManager.php - line 152:

    OCA\Mail\IMAP\MessageMapper->find(Horde_Imap_C ... e}, "INBOX", 2, true)

    /var/www/nextcloud/apps/mail/lib/Controller/MessagesController.php - line 219:

    OCA\Mail\Service\MailManager->getMessage(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox { id: 70}, 2, true)

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

    OCA\Mail\Controller\MessagesController->getBody(6, "SU5CT1g=", 2)

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

    OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Con ... {}, "getBody")

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 137:

    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Con ... {}, "getBody")

    /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

    OC\AppFramework\App::main("OCA\\Mail\\ ... r", "getBody", OC\AppFramew ... {}, { accountId: ... "})

    <<closure>>

    OC\AppFramework\Routing\RouteActionHandler->__invoke({ accountId: ... "})

    /var/www/nextcloud/lib/private/Route/Router.php - line 297:

    call_user_func(OC\AppFramew ... {}, { accountId: ... "})

    /var/www/nextcloud/lib/base.php - line 1007:

    OC\Route\Router->match("/apps/mail/ ... y")

    /var/www/nextcloud/index.php - line 37:

    OC::handleRequest()

I'm sorry, I was under the impression you opened another ticket today previously.

DoesNotExistException: Mail body for this mail(2) could not be loaded

This is strange. Does this really happen with all messages or just specific ones?

I'm sorry, I was under the impression you opened another ticket today previously.

No worries. I did open a previous issue, but I wasn't directed to any logs :)

DoesNotExistException: Mail body for this mail(2) could not be loaded

This is strange. Does this really happen with all messages or just specific ones?

All but one. The one that displays the body I attempted to reply using the app, and it populated the body. All others just fail to load.
FWIW, I've tested a fresh install of 19.0.2.2, when connecting to a different provider, the mailbox opens but no messages are shown in the inbox. horde_imap.log looks like everything goes well, server responses all OK, metadata is cached but no messages displayed. No errors in Admin Settings > Logging.
I'll have to reconfigure this original IMAP service (ProtonMail-Bridge) to test it/pull new logs. If needed, lemme know and I'll do so.

No errors in Admin Settings > Logging.

I assume you've lower the log level to debug, right?

No errors in Admin Settings > Logging.

I assume you've lower the log level to debug, right?

Correct. There was a warning stating "Not enough messages to train a classifier." but I assumed that was expected considering the circumstances.

I tested this again, dug a bit deeper, and realized that there are some messages I am able to open... Specifically, messages that have attachments are loaded correctly (some with data in the body and some without).

Well, that some insight. Usually it's the more complex messages that cause issues, but apparently there are also those where you least expect a problem.

See https://github.com/nextcloud/mail/issues/3541#issuecomment-689796930
copypasta recent log including double whacks (line 4):

[mail] Error: OCA\Mail\Exception\ServiceException: Could not load message at <<closure>>

0. /var/www/nextcloud/apps/mail/lib/Controller/MessagesController.php line 219
   OCA\Mail\Service\MailManager->getMessage(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox {id: 21}, 2, true)
1. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 170
   OCA\Mail\Controller\MessagesController->getBody(3, "SU5CT1g=", 2)
2. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 100
   OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Controller\MessagesController {}, "getBody")
3. /var/www/nextcloud/lib/private/AppFramework/App.php line 137
   OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Controller\MessagesController {}, "getBody")
4. /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
   OC\AppFramework\App::main("OCA\\Mail\\Cont ... r", "getBody", OC\AppFramework\ ... {}, {accountId: "3", ... "})
5. <<closure>>
   OC\AppFramework\Routing\RouteActionHandler->__invoke({accountId: "3", ... "})
6. /var/www/nextcloud/lib/private/Route/Router.php line 297
   call_user_func(OC\AppFramework\ ... {}, {accountId: "3", ... "})
7. /var/www/nextcloud/lib/base.php line 1012
   OC\Route\Router->match("/apps/mail/api/ ... y")
8. /var/www/nextcloud/index.php line 37
   OC::handleRequest()

GET /apps/mail/api/accounts/3/folders/SU5CT1g%3D/messages/2/body
from **redacted** by **redacted** at 2020-09-09T20:03:02+00:00

I think we improved this code a bit with the latest v1.5. Did you upgrade to Nextcloud 20 already?

Good to hear! I have not upgraded yet, but I will very soon and give this setup another try.

Thanks for the heads up!

I'm seeing similar error messages with the exact same setup (a containerized version of ProtonMail Bridge) using Mail v1.7.2 and NC v 20.0.4:

[mail] Error: OCA\Mail\Exception\ServiceException: Could not load message at <>

  1. /var/www/html/custom_apps/mail/lib/Controller/MessagesController.php line 233
    OCA\Mail\Service\MailManager->getImapMessage(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox {id: 56}, 4, true)
  2. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 169
    OCA\Mail\Controller\MessagesController->getBody(77)
  3. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 100
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Controller\MessagesController {}, "getBody")
  4. /var/www/html/lib/private/AppFramework/App.php line 152
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Controller\MessagesController {}, "getBody")
  5. /var/www/html/lib/private/Route/Router.php line 308
    OC\AppFramework\App::main("OCA\Mail\Cont ... r", "getBody", OC\AppFramework\ ... {}, {action: null,id ... "})
  6. /var/www/html/lib/base.php line 1008
    OC\Route\Router->match("/apps/mail/api/messages/77/body")
  7. /var/www/html/index.php line 37
    OC::handleRequest()

GET /apps/mail/api/messages/77/body
from 172.23.0.5 by paulcalabro at 2020-12-28T02:52:19+00:00

[mail] Error: OCA\Mail\Exception\ServiceException: Could not move message $7 from All Mail to Trash at <>

  1. /var/www/html/custom_apps/mail/lib/Service/MailManager.php line 311
    OCA\Mail\IMAP\MessageMapper->move(Horde_Imap_Clien ... e}, "All Mail", 7, "Trash")
  2. /var/www/html/custom_apps/mail/lib/Controller/MessagesController.php line 568
    OCA\Mail\Service\MailManager->deleteMessage(OCA\Mail\Account {}, "All Mail", 7)
  3. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 169
    OCA\Mail\Controller\MessagesController->destroy(80)
  4. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 100
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Controller\MessagesController {}, "destroy")
  5. /var/www/html/lib/private/AppFramework/App.php line 152
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Controller\MessagesController {}, "destroy")
  6. /var/www/html/lib/private/Route/Router.php line 308
    OC\AppFramework\App::main("OCA\Mail\Cont ... r", "destroy", OC\AppFramework\ ... {}, {action: null,id ... "})
  7. /var/www/html/lib/base.php line 1008
    OC\Route\Router->match("/apps/mail/api/messages/80")
  8. /var/www/html/index.php line 37
    OC::handleRequest()

DELETE /apps/mail/api/messages/80
from 172.23.0.5 by paulcalabro at 2020-12-28T02:50:06+00:00

@sauces1313 Were you able to get this working?
@ChristophWurst Any ideas on how to resolve the issue?

Here's some additional information from the ProtonMail Bridge container:

protonmail-bridge_1 | ERRO[Dec 28 02:59:21.608] list message build: wrong section 1 cmd=ListMessages metaID="NLbSmHW1-6vUwLkNzmhO_HVr-rAWsaDrWIX5adnrIJbJwEjYmuO2I6FjzAzif8i2-xX_kk9M8wJCvwL64E1N0Q==" pkg=imap
protonmail-bridge_1 | ERRO[Dec 28 02:59:21.618] cannot list messages (true, 8, [BODY.PEEK[1] BODY.PEEK[1.MIME] UID]): list message build: wrong section 1 pkg=imap
protonmail-bridge_1 | ERRO[Dec 28 02:59:22.903] list message build: wrong section 1 cmd=ListMessages metaID="ztuVY2P_oUNEbCY-l7aR9ZQWTCjOxEiOw3bhokf1elayu5-PxfwYxFr1J983nKilfJpErz4dmeE06xrzHuvx-Q==" pkg=imap
protonmail-bridge_1 | ERRO[Dec 28 02:59:22.905] cannot list messages (true, 1, [BODY.PEEK[1] BODY.PEEK[1.MIME] UID]): list message build: wrong section 1 pkg=imap

@paulcalabro, I have been occupied with other projects, so I never did configure the bridge again after the update like @ChristophWurst suggested. I will try to find some time to test it again since you're having the same issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

g6094199 picture g6094199  路  3Comments

ChristophWurst picture ChristophWurst  路  3Comments

benks-io picture benks-io  路  4Comments

jancborchardt picture jancborchardt  路  4Comments

Quix0r picture Quix0r  路  5Comments