Upgrade to 29.0.2from 28.0.6::: Error Index name "fileid" for table "p8bq_filecache_extended" collides

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


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:

Nextcloud version (eg, 29.0.5): replace me
Operating system and version (eg, Ubuntu 29.04): replace me
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 8.3): replace me

The issue you are facing:
@od-25eaec:~/web/nc$ ./occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Updating database schema
Updated database
InvalidArgumentException: Index name “fileid” for table “p8bq_filecache_extended” collides with the constraint on table “p8bq_filecache”.
Update failed
Maintenance mode is kept active
Resetting log level

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

Steps to replicate it:

  1. attempting to upgrade to 29.0.2

The output of your Nextcloud log in Admin > Logging:


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


The output of your Apache/nginx/system log in /var/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.


What database?

For some reason your db structure is wrong. fileid isn’t the index name (fce_pk is). Even previously it was something else.[1]

What’s the history of this installation (i.e. one has been upgraded through numerous major version bumps)? Have you ever manually added indexes to it in an attempt to optimize something? etc.

[1] server/core/Migrations/Version17000Date20190514105811.php at 54bf26ae50138606085cdaec50a8443bdf0b7b50 · nextcloud/server · GitHub

It’s only been through the stable major release upgrades.
I’ve not manually added db or fields.
28.0.6 (I restored my backup) is working fine.