Error in mail app: More than 1000 expressions in a list are not allowed on Oracle

Hello,

Just installed Nextcloud AIO Nextcloud Hub 10 (31.0.4) and after configuring a few users and appliations started to see incrementing errors in the log:

Error	core	
QueryException More than 1000 expressions in a list are not allowed on Oracle.
May 6, 2025, 11:53:59 AM	
Error	core	
QueryException More than 1000 expressions in a list are not allowed on Oracle.
May 6, 2025, 11:53:59 AM	
Error	core	
QueryException More than 1000 expressions in a list are not allowed on Oracle.
May 6, 2025, 11:53:59 AM	
Error	core	
QueryException More than 1000 expressions in a list are not allowed on Oracle.
May 6, 2025, 11:53:59 AM	
Error	core	
QueryException More than 1000 expressions in a list are not allowed on Oracle.
May 6, 2025, 11:53:59 AM	
Error	core	
QueryException More than 1000 expressions in a list are not allowed on Oracle.
May 6, 2025, 11:53:59 AM	
Error	core	
QueryException More than 1000 expressions in a list are not allowed on Oracle.
May 6, 2025, 11:53:59 AM
{
  "reqId": "Zgt1M8RPorhTTXwd7pT1",
  "level": 3,
  "time": "2025-05-05T06:53:30+00:00",
  "remoteAddr": "80.147.131.217",
  "user": "A****",
  "app": "core",
  "method": "POST",
  "url": "/apps/mail/api/mailboxes/11/sync",
  "message": "More than 1000 expressions in a list are not allowed on Oracle.",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",
  "version": "31.0.4.1",
  "exception": {
    "Exception": "Doctrine\\DBAL\\Query\\QueryException",
    "Message": "More than 1000 expressions in a list are not allowed on Oracle.",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",
        "line": 284,
        "function": "prepareForExecute",
        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/custom_apps/mail/lib/Db/StatisticsDao.php",
        "line": 185,
        "function": "executeQuery",
        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/custom_apps/mail/lib/Service/Classification/FeatureExtraction/ImportantMessagesExtractor.php",
        "line": 44,
        "function": "getNumberOfMessagesWithFlagGrouped",
        "class": "OCA\\Mail\\Db\\StatisticsDao",
        "type": "->",
        "args": [
          [
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 27
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 12
            },
            {
   "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 845
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 805
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 571
            },
            "And 1226 more entries, set log level to debug to see all entries"
          ],
          "important",
          [
            "notifications-noreply@linkedin.com"
          ]
        ]
      },
      {
        "file": "/var/www/html/custom_apps/mail/lib/Service/Classification/ImportanceRulesClassifier.php",
        "line": 57,
        "function": "prepare",
        "class": "OCA\\Mail\\Service\\Classification\\FeatureExtraction\\ImportantMessagesExtractor",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***",
          [
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 27
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 12
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 845
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 805
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 571
            },
            "And 1226 more entries, set log level to debug to see all entries"
          ],
          [    {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 14
            }
          ],
          [
            {
              "__class__": "OCA\\Mail\\Db\\Message",
              "id": 3369
            }
          ]
        ]
      },
      {
        "file": "/var/www/html/custom_apps/mail/lib/Service/Classification/ImportanceClassifier.php",
        "line": 453,
        "function": "classifyImportance",
        "class": "OCA\\Mail\\Service\\Classification\\ImportanceRulesClassifier",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***",
          [
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 27
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 12
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 845
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 805
            },
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 571
            },
            "And 1226 more entries, set log level to debug to see all entries"
          ],
          [
            {
              "__class__": "OCA\\Mail\\Db\\Mailbox",
              "id": 14
            }
          ],
          [   {
              "__class__": "OCA\\Mail\\Db\\Message",
              "id": 3369
            }
          ]
        ]
      },
      {
        "file": "/var/www/html/custom_apps/mail/lib/Service/Classification/NewMessagesClassifier.php",
        "line": 85,
        "function": "classifyImportance",
        "class": "OCA\\Mail\\Service\\Classification\\ImportanceClassifier",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***",
          [
            {
              "__class__": "OCA\\Mail\\Db\\Message",
              "id": 3369
            }
          ],
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
        "line": 445,
        "function": "classifyNewMessages",
        "class": "OCA\\Mail\\Service\\Classification\\NewMessagesClassifier",
        "type": "->",
        "args": [
          [
            {
              "__class__": "OCA\\Mail\\Db\\Message",
              "id": 3369
            }
          ],
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***",
          {
            "__class__": "OCA\\Mail\\Db\\Tag",
            "id": "*** sensitive parameters replaced ***"
          }
        ]
      },
      {
        "file": "/var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
        "line": 263,
        "function": "runPartialSync",
        "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***",
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/custom_apps/mail/lib/Service/Sync/SyncService.php",
        "line": 126,
        "function": "sync",
        "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/custom_apps/mail/lib/Controller/MailboxesController.php",
        "line": 144,
        "function": "syncMailbox",
        "class": "OCA\\Mail\\Service\\Sync\\SyncService",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 200,
        "function": "sync",
        "class": "OCA\\Mail\\Controller\\MailboxesController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 114,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Mail\\Controller\\MailboxesController"
          },
          "sync"

Searched for similar errors, but all I’ve found are from already fixed issues…

Best regards, Dario

Cc @ChristophWurst

Do you have more than 1000 folders in your mail account?

folders? nope, emails yes, thoushands! but folders only the usual ones and a copule more

Okay!

It seems the stack trace is cut off, could you please post the complete stack trace at: ImportanceClassifier: More than 1000 expressions in a list are not allowed on Oracle. · Issue #9069 · nextcloud/mail · GitHub.