Index oc_addressbooks is corrupted after Update from 26.0.13 to 27.1.9

Nextcloud version (eg, 20.0.5): Upgrade to 27.1.9
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.4 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.52-1ubuntu4.9
PHP version (eg, 7.4): 8.1.2-1ubuntu2.17

The issue you are facing: error message in overview after upgrade (unsupported old version)

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Upgrade from 26.0.13 to 27.1.9
  2. Warning in Overview: Sync DAV-Systemaddressbook not run, do occ dav:sync-system-addressbook
  3. in bash, use the occ command → error message
root@nc:~# cd /var/www/html/nextcloud/
root@nc:/var/www/html/nextcloud# sudo -u www-data php occ dav:sync-system-addressbook
Syncing users ...
    0 [>---------------------------]
In DbalException.php line 71:

  An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1712 Index oc_addressbooks is corrupted


In ExceptionConverter.php line 119:

  An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1712 Index oc_addressbooks is corrupted


In Exception.php line 30:

  SQLSTATE[HY000]: General error: 1712 Index oc_addressbooks is corrupted


In Statement.php line 101:

  SQLSTATE[HY000]: General error: 1712 Index oc_addressbooks is corrupted


dav:sync-system-addressbook

root@nc:/var/www/html/nextcloud#

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

root@nc:~# cd /var/www/html/nextcloud/
root@nc:/var/www/html/nextcloud# sudo -u www-data php occ dav:sync-system-addressbook
Syncing users ...
    0 [>---------------------------]
In DbalException.php line 71:

  An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1712 Index oc_addressbooks is corrupted


In ExceptionConverter.php line 119:

  An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1712 Index oc_addressbooks is corrupted


In Exception.php line 30:

  SQLSTATE[HY000]: General error: 1712 Index oc_addressbooks is corrupted


In Statement.php line 101:

  SQLSTATE[HY000]: General error: 1712 Index oc_addressbooks is corrupted


dav:sync-system-addressbook

root@nc:/var/www/html/nextcloud#

The output of your Apache/nginx/system log in /var/log/____:

  • no errors in errror.log or access.log -

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{"reqId":"GtZVEgdDdzx6Zf41EzLE","level":3,"time":"2024-05-17T09:34:11+02:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Error while running background job (class: OCA\\GroupFolders\\BackgroundJob\\ExpireGroupTrash, arguments: )","userAgent":"--","version":"27.1.9.1","exception":{"Exception":"OC\\DB\\Exceptions\\DbalException","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1712 Index oc_group_folders_trash is corrupted","Code":1712,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":295,"function":"wrap","class":"OC\\DB\\Exceptions\\DbalException","type":"::"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/Trash/TrashManager.php","line":44,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/Trash/TrashBackend.php","line":395,"function":"listTrashForFolders","class":"OCA\\GroupFolders\\Trash\\TrashManager","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupTrash.php","line":58,"function":"expire","class":"OCA\\GroupFolders\\Trash\\TrashBackend","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OCA\\GroupFolders\\BackgroundJob\\ExpireGroupTrash","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/lib/private/DB/Exceptions/DbalException.php","Line":71,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1712 Index oc_group_folders_trash is corrupted","Code":1712,"Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1814,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1749,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1055,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/Connection.php","line":262,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":345,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":293,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/Trash/TrashManager.php","line":44,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/Trash/TrashBackend.php","line":395,"function":"listTrashForFolders","class":"OCA\\GroupFolders\\Trash\\TrashManager","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupTrash.php","line":58,"function":"expire","class":"OCA\\GroupFolders\\Trash\\TrashBackend","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OCA\\GroupFolders\\BackgroundJob\\ExpireGroupTrash","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":119,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[HY000]: General error: 1712 Index oc_group_folders_trash is corrupted","Code":1712,"Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":103,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1045,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/Connection.php","line":262,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":345,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":293,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/Trash/TrashManager.php","line":44,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/Trash/TrashBackend.php","line":395,"function":"listTrashForFolders","class":"OCA\\GroupFolders\\Trash\\TrashManager","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupTrash.php","line":58,"function":"expire","class":"OCA\\GroupFolders\\Trash\\TrashBackend","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OCA\\GroupFolders\\BackgroundJob\\ExpireGroupTrash","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":30,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[HY000]: General error: 1712 Index oc_group_folders_trash is corrupted","Code":"HY000","Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":101,"function":"execute","class":"PDOStatement","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1045,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/Connection.php","line":262,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":345,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":293,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/Trash/TrashManager.php","line":44,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/Trash/TrashBackend.php","line":395,"function":"listTrashForFolders","class":"OCA\\GroupFolders\\Trash\\TrashManager","type":"->"},{"file":"/var/www/html/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupTrash.php","line":58,"function":"expire","class":"OCA\\GroupFolders\\Trash\\TrashBackend","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OCA\\GroupFolders\\BackgroundJob\\ExpireGroupTrash","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":101}}},"message":"Error while running background job (class: OCA\\GroupFolders\\BackgroundJob\\ExpireGroupTrash, arguments: )","exception":{},"CustomMessage":"Error while running background job (class: OCA\\GroupFolders\\BackgroundJob\\ExpireGroupTrash, arguments: )"}}

This isn’t generally something I’d expect to be possible for Nextcloud itself to cause, but it’s possible upgrading brought it out.

This is a corruption in your database. Due to something like an failing storage/drive, improper shutdown (crash, power loss), partial restore attempt, or odd db (e.g. MariaDB/MySQL) bug.

Which db are you using and what version?

I suggest checking your database error logs as well as host system general logs (kernel in particular).

A MySQL mysqlcheck and/or REPAIR may remedy it.

But given the nature of the problem, figuring out the probable root cause is more important then just fixing the current situation.

If you use your favorite search engine you’ll find some resources. Also there are some threads here on the forum too.

Its a vm and we haven’t had any crash recently or corrupted disks.

The mariadb version is 10.6.16

No entrys in the error.log file of mysql.

Try to repair the db-table → “The storage engine for the table doesn’t support repair”

I resolved the error with db restore.
stop apache2 → make DB Backup → drop nextcloud database → restore only the nextcloud database from backup → start apache2

Here the commands to do this in our case. (automysqlbackup is deprecaded)

systemctl stop apache2 
automysqlbackup 
-> check /var/lib/automysqlbackup/... 

gzip -d /var/lib/automysqlbackup/... 
mysql --host=localhost --user=root --no-auto-rehash --default-character-set=utf8mb4 
CREATE DATABASE database_name; exit 
mysql -u root -p --one-database database_name < 202xxxx.sql 
systemctl start apache2

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.