Upgrade to 33 runs into db error

Support intro

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 32
  • Operating system and version (e.g., Ubuntu 24.04):
    • debian 12.14
  • Web server and version (e.g, Apache 2.4.25):
    • nginx/1.22.
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • nginx/1.22.
  • PHP version (e.g, 8.3):
    • 8.2.31
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • while upgrade to 33
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • GUI
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

sudo -E -u www-data php occ upgrade -vvv
July 01, 2026 18:46:34 Setting log level to debug
July 01, 2026 18:46:34 Repair step: Repair MySQL collation
July 01, 2026 18:46:34 Repair info: All tables already have the correct collation → nothing to do
July 01, 2026 18:46:34 Repair step: Copy data from accounts table when migrating from ownCloud
July 01, 2026 18:46:35 Repair step: Drop account terms table when migrating from ownCloud
July 01, 2026 18:46:35 Updating database schema
July 01, 2026 18:46:35 Exception: Database error when running migration 33000Date20251023120529 for app core
An index with name “unique_bucket_store” was already defined on table “oc_preview_locations”.
July 01, 2026 18:46:35 Update failed
July 01, 2026 18:46:35 Maintenance mode is kept active

Steps to replicate it (hint: details matter!):

  1. try upgrade via console or GUI

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

PASTE HEREutf8mb4

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

Firefox

Web server / Reverse Proxy

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

PASTE HERE

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

  • preformatted {
    “system”: {
    “instanceid”: “***REMOVED SENSITIVE VALUE***”,
    “passwordsalt”: “***REMOVED SENSITIVE VALUE***”,
    “datadirectory”: “***REMOVED SENSITIVE VALUE***”,
    “dbtype”: “mysql”,
    “version”: “32.0.12.1”,
    “dbname”: “***REMOVED SENSITIVE VALUE***”,
    “dbhost”: “***REMOVED SENSITIVE VALUE***”,
    “dbtableprefix”: “oc_”,
    “dbuser”: “***REMOVED SENSITIVE VALUE***”,
    “dbpassword”: “***REMOVED SENSITIVE VALUE***”,
    “installed”: true,
    “forcessl”: true,
    “theme”: “”,
    “maintenance”: false,
    “trusted_domains”: [
    “***REMOVED SENSITIVE VALUE***”,
    “***REMOVED SENSITIVE VALUE***”,
    “***REMOVED SENSITIVE VALUE***”,
    “***REMOVED SENSITIVE VALUE***”
    ],
    “log_type”: “file”,
    “logfile”: “\/var\/log\/nextcloud.log”,
    “loglevel”: 0,
    “logdateformat”: “F d, Y H:i:s”,
    “secret”: “***REMOVED SENSITIVE VALUE***”,
    “trashbin_retention_obligation”: “auto”,
    “mail_from_address”: “***REMOVED SENSITIVE VALUE***”,
    “mail_smtpmode”: “smtp”,
    “mail_domain”: “***REMOVED SENSITIVE VALUE***”,
    “overwrite.cli.url”: “***REMOVED SENSITIVE VALUE***”,
    “mail_smtpsecure”: “tls”,
    “mail_sendmailmode”: “smtp”,
    “mail_smtphost”: “***REMOVED SENSITIVE VALUE***”,
    “mail_smtpport”: “587”,
    “mail_smtpauthtype”: “PLAIN”,
    “mail_smtpauth”: 1,
    “mail_smtpname”: “***REMOVED SENSITIVE VALUE***”,
    “mail_smtppassword”: “***REMOVED SENSITIVE VALUE***”,
    “music.lastfm_api_key”: “***REMOVED SENSITIVE VALUE***”,
    “app_install_overwrite”: [
    “hancomoffice”,
    “ransomware_detection”,
    “snappymail”
    ],
    “mysql.utf8mb4”: true,
    “defaultapp”: “snappymail,dashboard,files”,
    “updater.secret”: “***REMOVED SENSITIVE VALUE***”,
    “files.chunked_upload.max_size”: 20971520,
    “trusted_proxies”: “***REMOVED SENSITIVE VALUE***”,
    “default_phone_region”: “DE”,
    “memcache.local”: “\\OC\\Memcache\\APCu”,
    “filelocking.enabled”: “true”,
    “memcache.locking”: “\\OC\\Memcache\\Redis”,
    “redis”: {
    “host”: “***REMOVED SENSITIVE VALUE***”,
    “port”: 6379,
    “timeout”: 0
    }
    }
    }

Apps

The output of occ app:list (if possible).

  • Enabled:
    • activity: 5.0.0
    • app_api: 32.0.0
    • audioplayer: 3.9.0
    • bruteforcesettings: 5.0.0
    • calendar: 6.5.0
    • circles: 32.0.0
    • cloud_federation_api: 1.16.0
    • comments: 1.22.0
    • contacts: 8.3.14
    • dashboard: 7.12.0
    • dav: 1.34.2
    • encryption: 2.20.0
    • federatedfilesharing: 1.22.0
    • federation: 1.22.0
    • files: 2.4.0
    • files_downloadlimit: 5.0.0
    • files_notify_redis: 0.3.8
    • files_pdfviewer: 5.0.0
    • files_reminders: 1.5.0
    • files_sharing: 1.24.1
    • files_trashbin: 1.22.0
    • files_versions: 1.25.0
    • firstrunwizard: 5.0.0
    • logreader: 5.0.0
    • lookup_server_connector: 1.20.0
    • mail: 5.10.5
    • music: 3.1.0
    • nextcloud_announcements: 4.0.0
    • notifications: 5.0.0
    • notify_push: 1.3.3
    • oauth2: 1.20.0
    • passwords: 2026.6.10
    • photos: 5.0.0
    • polls: 9.1.4
    • privacy: 4.0.0
    • profile: 1.1.0
    • provisioning_api: 1.22.0
    • qownnotesapi: 26.5.0
    • recommendations: 5.0.0
    • related_resources: 3.0.0
    • serverinfo: 4.0.0
    • settings: 1.15.1
    • sharebymail: 1.22.0
    • support: 4.0.0
    • survey_client: 4.0.0
    • systemtags: 1.22.0
    • theming: 2.7.0
    • twofactor_backupcodes: 1.21.0
    • twofactor_totp: 14.0.0
    • updatenotification: 1.22.0
    • user_status: 1.12.0
    • viewer: 5.0.0
    • webhook_listeners: 1.3.0
    • workflowengine: 2.14.0
      Disabled:
    • admin_audit: 1.23.0
    • contactsinteraction: 1.14.1 (installed 1.1.0)
    • files_external: 1.25.1
    • password_policy: 5.0.0 (installed 4.0.0)
    • suspicious_login: 11.0.0
    • text: 7.0.1 (installed 3.4.0)
    • twofactor_nextcloud_notification: 7.0.0
    • user_ldap: 1.24.0
    • weather_status: 1.13.0 (installed 1.0.0

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

delete the index manually and try again

That index doesn’t exist <v33. Any chance this wasn’t the first time attempting to run the upgrade to v33 and/or the db was restored from backup?

Hello,

now I have recovered the db and updated 31.0.8->31.0.14->32.0.12

The DB in V 32 looks like:

MariaDB [owncloud]> show columns from oc_preview_locations;
+-------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+---------------------+------+-----+---------+-------+
| id | bigint(20) unsigned | NO | PRI | NULL | |
| bucket_name | varchar(40) | NO | MUL | NULL | |
| object_store_name | varchar(40) | NO | | NULL | |
+-------------------+---------------------+------+-----+---------+-------+

But If I than try to update to 33.0.6 I get this error:

sudo -E -u www-data php occ upgrade -vvv
July 02, 2026 08:57:31 Setting log level to debug
July 02, 2026 08:57:32 Turned on maintenance mode
July 02, 2026 08:57:32 Repair step: Repair MySQL collation
July 02, 2026 08:57:32 Repair info: All tables already have the correct collation -> nothing to do
July 02, 2026 08:57:32 Repair step: Copy data from accounts table when migrating from ownCloud
July 02, 2026 08:57:32 Repair step: Drop account terms table when migrating from ownCloud
July 02, 2026 08:57:32 Updating database schema
July 02, 2026 08:57:36 Exception: Database error when running migration 33000Date20251023120529 for app core
An index with name "unique_bucket_store" was already defined on table "oc_preview_locations".
July 02, 2026 08:57:36 Update failed
July 02, 2026 08:57:36 Maintenance mode is kept active
July 02, 2026 08:57:36 Resetting log level

So, before update the Field didn’t exists

Hmm. The entire preview_locations doesn’t even exist until v33 so something is wrong if you even have that table in your v32 database snapshot.

Hmm.

so, can I simply delete the table oc_preview_locations?

Yes, I can.

Thanks